UNPKG

911 BMarkdownView Raw
1## _readline_
2> Read a file line by line.
3
4## Install
5
6## Important. In node 10 there is a core module named readline. Please use linebyline instead, it is the same module just renamed:
7[Npm linebyline](https://www.npmjs.com/package/linebyline)
8
9```sh
10npm install linebyline
11```
12
13## Test
14```sh
15npm install .
16npm test
17
18```
19
20
21## What's this?
22
23Simple streaming readline module for NodeJS. Reads a file and buffer new lines emitting a _line_ event for each line.
24
25## Usage
26```js
27 var readline = require('linebyline'),
28 rl = readline('./somefile.txt');
29 rl.on('line', function(line, lineCount, byteCount) {
30 // do something with the line of text
31 })
32 .on('error', function(e) {
33 // something went wrong
34 });
35```
36##API
37## readfile(readingObject)
38### Params:
39
40* **** *readingObject* {file path or stream}
41
42### Return:
43
44* **EventEmitter**
45
46
47## License
48
49BSD © [Craig Brookes](http://craigbrookes.com/)