unzip-stream
unzip-stream copied to clipboard
Uncatchable errors
Entries are created in stream, can't find any way to subscribe on entry errors before UnzipStream.prototype._prepareOutStream function call. So every error emitted in this function throws exception.
When I got a bad zip to unzip, the app crashes, and there is no option to catch the error (except catching all global exceptions).
In the following app, I expect to get an error callback, but it get an exception: (events.js:291: "throw er; // Unhandled 'error' event") :
require("fs").createReadStream('bad.zip').pipe(require("unzip-stream") .Extract({ path: 'output' })) .on('error', (err)=>{ console.log(err); }).on("close", ()=>{ console.log("on closeed"); });
bad.zip
I found the Update unzip-stream.js pull request. It solves the problem.
Hi @vdanika, It should be fixed by this pull request