Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Created October 22, 2018 14:22
Show Gist options
  • Save mafintosh/cfabdae92ec4bf1e2412cec10842f7c8 to your computer and use it in GitHub Desktop.
Save mafintosh/cfabdae92ec4bf1e2412cec10842f7c8 to your computer and use it in GitHub Desktop.
const zlib = require('zlib')
const { Writable } = require('stream')
const ts = zlib.createGzip()
const ws = new Writable({
write (chunk, enc, cb) {
setImmediate(cb)
ts.close()
}
})
const buf = Buffer.allocUnsafe(1024 * 1024 * 20)
ts.end(buf)
ts.pipe(ws)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment