0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/parallel/test-zlib-deflate-raw-inherits.js
James M Snell 7024c5a302 zlib: revert back to Functions
Using ES6 Classes broke userland code. Revert back to functions.

PR-URL: https://github.com/nodejs/node/pull/13374
Fixes: https://github.com/nodejs/node/issues/13358
Ref: https://github.com/nodejs/node/pull/13370
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-06-05 10:56:52 -07:00

28 lines
542 B
JavaScript

'use strict';
require('../common');
const { DeflateRaw } = require('zlib');
const { inherits } = require('util');
const { Readable } = require('stream');
// validates that zlib.DeflateRaw can be inherited
// with util.inherits
function NotInitialized(options) {
DeflateRaw.call(this, options);
this.prop = true;
}
inherits(NotInitialized, DeflateRaw);
const dest = new NotInitialized();
const read = new Readable({
read() {
this.push(Buffer.from('a test string'));
this.push(null);
}
});
read.pipe(dest);
dest.resume();