Skip to content

Commit 88d4a88

Browse files
authored
Work around issue in Node.js 8.0.0
This works around the issue in Node.js 8.0.0 where `zlib.DeflateRaw`'s constructor returns an object rather than mutating `this`. Fixes: archiverjs#5
1 parent 6e835b2 commit 88d4a88

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/deflate-crc32-stream.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
* https://github.com/archiverjs/node-crc32-stream/blob/master/LICENSE-MIT
77
*/
88
var zlib = require('zlib');
9+
var extend = Object.assign || require('util')._extend
910
var inherits = require('util').inherits;
1011

1112
var crc32 = require('crc').crc32;
1213

1314
var DeflateCRC32Stream = module.exports = function (options) {
14-
zlib.DeflateRaw.call(this, options);
15+
var stream = zlib.DeflateRaw.call(this, options);
16+
if (stream) extend(this, stream)
1517

1618
this.checksum = new Buffer(4);
1719
this.checksum.writeInt32BE(0, 0);

0 commit comments

Comments
 (0)