readlinesyn
v0.3.2
Published
Reading a text file line by line, synchrony version
Downloads
4
Maintainers
Readme
readlinesyn
Reading a text file line by line in synchrony mode.
Methods
- open( filePath )
- close()
- next()
- isEOF()
Installation
readlinesyn requires Node.js v4+ to run.
$ npm install readlinesyn
Example
const LineByLine = require('readlinesyn');
var filename = './result.txt';
var liner = new LineByLine();
var theline;
// the default encode is 'utf8'
// liner._encode = "utf8";
liner.open( filename );
while( !liner.isEOF() )
{
theline = liner.next();
console.log( 'READ LINE: ' + theline );
}
liner.close();