Thursday, 18 May 2017

Error: unexpected end of file at Zlib._handle.onerror (zlib.js:355:17)

I am new in Node.js. when I decompressed input.txt.gz got an error. this is the error
Error: unexpected end of file at Zlib._handle.onerror (zlib.js:355:17).

I am using this code

var zlib = require('zlib');

//Decompress the file input.txt.gz to input.txt
var gunzip = zlib.createGunzip();

fs.createReadStream('input.txt.gz')
   .pipe(gunzip).pipe(fs.createWriteStream('input.txt'));

gunzip.on('error', function(error){
    console.log('Error occurs: '+error.stack);
});

console.log('File decompreessed.');



via Rohit Parihar

No comments:

Post a Comment