Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ function flushCallback(level, strategy, callback) {
// true or false if there is anything in the queue when
// you call the .write() method.
function Zlib(opts, mode) {
Transform.call(this, opts);
var chunkSize = Z_DEFAULT_CHUNK;
var flush = Z_NO_FLUSH;
var finishFlush = Z_FINISH;
Expand Down Expand Up @@ -257,6 +256,7 @@ function Zlib(opts, mode) {
opts.writableObjectMode = false;
}
}
Transform.call(this, opts);
this.bytesRead = 0;
this._handle = new binding.Zlib(mode);
this._handle.jsref = this; // Used by processCallback() and zlibOnError()
Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-zlib-object-write.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

require('../common');
const assert = require('assert');
const { Gunzip } = require('zlib');

const gunzip = new Gunzip({ objectMode: true });
assert.throws(
() => gunzip.write({}),
TypeError
);