Skip to content

Commit

Permalink
Merge pull request #1 from StreetHub/streethub
Browse files Browse the repository at this point in the history
Added open emit
  • Loading branch information
Osterjour committed Aug 19, 2015
2 parents b75ab3d + 9a33b4b commit a613981
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ lr.on('error', function (err) {
throw err;
});

lr.on('open', function() {
// Do something, like initialise progress bar etc.
});

lr.on('line', function (line) {
console.log(++row + ": " + line);
});
Expand Down
4 changes: 4 additions & 0 deletions line-by-line.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ LineByLineReader.prototype._initStream = function () {
self.emit('error', err);
});

readStream.on('open', function () {
self.emit('open');
});

readStream.on('data', function (data) {
self._readStream.pause();
self._lines = self._lines.concat(data.split(/(?:\n|\r\n|\r)/g));
Expand Down

0 comments on commit a613981

Please sign in to comment.