unzip-stream icon indicating copy to clipboard operation
unzip-stream copied to clipboard

Uncatchable errors

Open vdanika opened this issue 4 years ago • 2 comments

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

vdanika avatar Sep 26 '21 19:09 vdanika

I found the Update unzip-stream.js pull request. It solves the problem.

vdanika avatar Sep 26 '21 19:09 vdanika

Hi @vdanika, It should be fixed by this pull request

mickeyjohn avatar Sep 28 '22 20:09 mickeyjohn