Welcome to the Linux Foundation Forum!

Working with Streams - Readable-Writable Streams bug with zlib.createGunzip on node 14.15.2+

The Gzip example in Working with Streams - Readable-Writable Streams fails when running on node 14.15.2+. There appears to be a fix but it is not backported to Node 14 LTS yet (https://github.com/nodejs/node/issues/36615). In the same issue it appears that if you add const stream = require('stream'); that will provide a temporary fix. The working code is as per below

  1. 'use strict'
  2. const stream = require('stream');
  3. const { createGzip } = require('zlib')
  4. const transform = createGzip()
  5. transform.on('data', (data) => {
  6. console.log('got gzip data', data.toString('base64'))
  7. })
  8. transform.write('first')
  9. setTimeout(() => {
  10. transform.end('second')
  11. }, 500)

Comments

  • very nice work @seetdev - I don't see a bug of this severity taking long to back port so I'm going to leave the material as is for now and check back in at a later date

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training