Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

---


array-split-stream


a nodeJS transform stream that splits arrays










---

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.