Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blahah/array-split-stream
a nodeJS transform stream that splits arrays
https://github.com/blahah/array-split-stream
Last synced: 6 days ago
JSON representation
a nodeJS transform stream that splits arrays
- Host: GitHub
- URL: https://github.com/blahah/array-split-stream
- Owner: blahah
- License: cc0-1.0
- Created: 2017-04-17T15:24:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-17T15:33:45.000Z (over 7 years ago)
- Last Synced: 2024-09-19T00:59:08.690Z (about 2 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
---
---
A nodeJS [through2](https://github.com/rvagg/through2) transform stream that splits incoming arrays, emitting each array entry as a separate data event.
## Install
```
npm install array-split-stream
```## Usage
``` js
var splitter = require('array-split-stream')()splitter.on('data', function(entry) {
console.log('entry:', entry)
})splitter.on('end', function() {
console.log('done')
})splitter.write([1, 2, 3])
splitter.write(['orange', 'apple', 'tomato'])
splitter.end()// entry: 1
// entry: 2
// entry: 3
// entry: orange
// entry: apple
// entry: tomato
// done
```## License
To the extent possible by law, we transfer any rights we have in this code to the public domain. Specifically, we do so using the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).
You can do whatever you want with this code. No need to credit us, link to us, include any license, or anything else. But if you want to do those things, you're free to do that too.