11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst zlib = require('zlib'); 51cb0ef41Sopenharmony_ciconst { Writable } = require('stream'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci// Verify that the zlib transform does not error in case 81cb0ef41Sopenharmony_ci// it is destroyed with data still in flight 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ciconst ts = zlib.createGzip(); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_ciconst ws = new Writable({ 131cb0ef41Sopenharmony_ci write: common.mustCall((chunk, enc, cb) => { 141cb0ef41Sopenharmony_ci setImmediate(cb); 151cb0ef41Sopenharmony_ci ts.destroy(); 161cb0ef41Sopenharmony_ci }) 171cb0ef41Sopenharmony_ci}); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciconst buf = Buffer.allocUnsafe(1024 * 1024 * 20); 201cb0ef41Sopenharmony_cits.end(buf); 211cb0ef41Sopenharmony_cits.pipe(ws); 22