Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lordnox/node-linestream
library to read a stream line by line
https://github.com/lordnox/node-linestream
Last synced: 26 days ago
JSON representation
library to read a stream line by line
- Host: GitHub
- URL: https://github.com/lordnox/node-linestream
- Owner: lordnox
- Created: 2012-03-05T18:40:15.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-03-05T18:50:40.000Z (over 12 years ago)
- Last Synced: 2024-04-17T05:17:18.884Z (7 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 89.8 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# line-stream
Line-stream breaks any stream into seperate lines
## How to Install
npm install line-stream
## How to use
First, require `line-stream`:
```js
var Linestream = require('line-stream');
```Now we can parse this script and put linenumbers infront of each line, like `cat -n` would do
```js
// libs needed for the example
var fs = require('fs');stream = new Linestream(fs.createReadStream(__filename));
stream.on('line', function(line, no) {
console.log(no + ': ' + line);
});stream.on('end', function() {
console.log('EOF');
});stream.on('error', function(err) {});
```