Node.js zlib decompress gz file

Description

Node.js zlib decompress gz file


var fs = require("fs");
var zlib = require('zlib');

// Decompress the file input.txt.gz to input.txt
fs.createReadStream('input.txt.gz')
  .pipe(zlib.createGunzip())/*from  w  ww .  j  a v a 2s.  c  om*/
  .pipe(fs.createWriteStream('input.txt'));

console.log("File Decompressed.");



PreviousNext

Related