1'use strict'; 2 3const common = require('../common'); 4const zlib = require('zlib'); 5const { Writable } = require('stream'); 6 7// Verify that the zlib transform does not error in case 8// it is destroyed with data still in flight 9 10const ts = zlib.createGzip(); 11 12const ws = new Writable({ 13 write: common.mustCall((chunk, enc, cb) => { 14 setImmediate(cb); 15 ts.destroy(); 16 }) 17}); 18 19const buf = Buffer.allocUnsafe(1024 * 1024 * 20); 20ts.end(buf); 21ts.pipe(ws); 22