Here's the code:
varzlib=require('zlib');varfs=require('fs');fs.createReadStream('test.gz').pipe(zlib.createGunzip()).on('error',function(err){console.log("ERROR",err);}).pipe(fs.createWriteStream('test')).on('finish',function(){console.log("DONE");});I take a big valid gz file and do:
head -n 100000 ~/valid.gz > test.gz
Now test.gz is an unfinished archive:
> gunzip -k test.gz
gunzip: test.gz: unexpected end of file
gunzip: test.gz: uncompress failed
...But the aforementioned script shows DONE on this (unfinished) archive. No error.
There should be.
Here's the code:
I take a big valid
gzfile and do:Now
test.gzis an unfinished archive:...But the aforementioned script shows DONE on this (unfinished) archive. No error.
There should be.