1.0.1 • Published 10 years ago
line-read v1.0.1
line-read 
Read line by line from a stream, file or stdin lazily.
Install
$ npm install --save line-readUsage
Read all lines from a small file in one go
var readline = require('line-read');
readline.readLineFromFile('filename').join(function(xs) {
// xs is the list of lines from the file
});To read from a very large file, it would be better to read each line one by one.
var readline = require('line-read');
readline.readLineFromFile('filename').forEach(function(line) {
console.log(line);
});Reading from stdin is similar to reading from a large file
var readline = require('line-read');
readline.readLine(process.stdin).forEach(function(line) {
console.log('line ' + line);
});API
All methods return a lazy instance of lines. See the lazy package for more details.
readLine(stream, separator)
Get lines from stream. Lines are separated by separator, default to \n.
readLineFromFile(filename, separator)
Get lines from file filename. Lines are separated by separator, default to \n.
License
MIT © Minh Ha