https://github.com/bubkoo/on-new-line
Hijacks NodeJS Stream and emits events when newline(s) written to the output.
https://github.com/bubkoo/on-new-line
Last synced: 11 months ago
JSON representation
Hijacks NodeJS Stream and emits events when newline(s) written to the output.
- Host: GitHub
- URL: https://github.com/bubkoo/on-new-line
- Owner: bubkoo
- License: mit
- Created: 2016-03-11T13:11:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-16T08:22:04.000Z (about 10 years ago)
- Last Synced: 2024-10-04T13:42:18.056Z (over 1 year ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# on-new-line
> Hijacks NodeJS Stream and emits events when newline(s) written to the output.
[](https://github.com/bubkoo/on-new-line/blob/master/LICENSE)
[](https://www.npmjs.com/packages/on-new-line)
## Install
```
$ npm install on-new-line --save
```
## Usage
```js
require('on-new-line')(stream); // Any type of NodeJS stream, such as: filestream, process.stdout etc.
// emitted on every newline detected
stream.on('newline', function() {
});
// emitted before data written to the output.
stream.on('before:newlines', function(lineCount) {
});
// emitted after data written to the output.
stream.on('after:newlines', function(lineCount) {
});
```
## Contributing
Pull requests and stars are highly welcome.
For bugs and feature requests, please [create an issue](https://github.com/bubkoo/on-new-line/issues/new).