Skip to content

Commit

Permalink
Merge GZIP + Error: ENOENT: no such file or directory jahewson#15 fro…
Browse files Browse the repository at this point in the history
…m original

jahewson#15
  • Loading branch information
belaa007 authored Oct 18, 2018
1 parent ee96b13 commit 6229c9d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/big-xml.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ function BigXmlReader(filename, recordRegEx, options) {
var parser = new expat.Parser('UTF-8');
var stream = typeof filename === "string" ? fs.createReadStream(filename) : filename;

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;
}
Expand All @@ -31,10 +38,6 @@ function BigXmlReader(filename, recordRegEx, options) {
}
});

stream.on('error', function(err) {
self.emit('error', new Error(err));
});

///////////////////////////

var node = {};
Expand Down

0 comments on commit 6229c9d

Please sign in to comment.