Gunzip a stream if needed
Transform
stream which acts as zlib.Gunzip
if input is gzipped. Fallback otherwise to a simple PassThrough
stream.
$ npm install gunzip-stream
const fs = require('fs');
const {createGunzip} = require('gunzip-stream')
fs.createReadStream('/path/to/file.gz.or.not')
.pipe(createGunzip())
.pipe(process.stdout)
MIT