You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
}
The text was updated successfully, but these errors were encountered:
belaa007
added a commit
to belaa007/node-big-xml
that referenced
this issue
Oct 18, 2018
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:
After this, in line 34, there is indeed an intended error handling:
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 :
The text was updated successfully, but these errors were encountered: