v8.0.0 — zlib.DeflateRaw only extensible via class keyword
- Version: v8.0.0
- Platform: Darwin
- Subsystem: zlib
Extending zlib.DeflateRaw via non-class-keyword doesn't work. You can see this in action with this example:
'use strict' const zlib = require('zlib'); const inherits = require('util').inherits; function NotInitialized (options) { zlib.DeflateRaw.call(this, options); this.prop = true } inherits(NotInitialized, zlib.DeflateRaw); console.log(new NotInitialized())
The above prints out NotInitialized { prop: true }
What I expected it to do, was what this example does:
'use strict' const zlib = require('zlib'); class Initialized extends zlib.DeflateRaw { constructor (options) { super(options) this.prop = true } } console.log(new Initialized())
Not doing this initialization means that many stream operations result in crashes. (For example, pipe.)
This shows up in the real world with crc32-stream.