1.0.1 • Published 9 years ago
line-to-line v1.0.1
Line to Line
A module to read files line by line, returning read lines and the total of bytes read.
Install
# npm install line-to-lineTest
$ npm install
$ npm testAPI
Parameters
- stream - Stream object.
 
Events
lineemit line of the file.closeemit close of stream.erroremit error of stream.openemit open of stream.
Return
- EventEmitter
 
Using
var fs = require('fs');
var path = require('path');
var LineToLine = require('line-to-line').LineToLine;
var lineToLine = new LineToLine(fs.createReadStream(path.normalize('./path/file.csv')));
lineToLine.on('line', (line, lineCount, byteCount) => {
  console.log(line);
  console.log(lineCount);
  console.log(byteCount);
  console.log();
});
lineToLine.on('open', fd => console.log(fd));
lineToLine.on('error', err => console.log(err));
lineToLine.on('close', () => console.log('close'));License
- MIT