-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
If you use gzip: true, and the file doesn't exist, the module throws an unhandles exception:
{ Error: ENOENT: no such file or directory, open 'asd' errno: -2, code: 'ENOENT', syscall: 'open', path: 'asd' }
The issue is in the big-xml.js file, starting line 20:
if (options.gzip) {
var gunzip = zlib.createGunzip();
stream.pipe(gunzip);
stream = gunzip;
}
After this, in line 34, there is indeed an intended error handling:
stream.on('error', function(err) {
self.emit('error', new Error(err));
});
But since here the stream variable is not
var stream = fs.createReadStream(filename);
anymore, it cannot catch errors from from the original stream variable.
My idea to fix this would be to raise the stream.on before the if block, and add a plus error listener in the if block :
stream.on('error', function(err) {
self.emit('error', new Error(err));
});
if (options.gzip) {
var gunzip = zlib.createGunzip();
gunzip.on('error', function(err) {
self.emit('error', new Error(err));
});
stream.pipe(gunzip);
stream = gunzip;
}
Metadata
Metadata
Assignees
Labels
No labels