Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binocarlos/cascade-stream
A duplex stream that can lazily create child streams from a chunk and merge all outputs into one
https://github.com/binocarlos/cascade-stream
Last synced: 10 days ago
JSON representation
A duplex stream that can lazily create child streams from a chunk and merge all outputs into one
- Host: GitHub
- URL: https://github.com/binocarlos/cascade-stream
- Owner: binocarlos
- License: mit
- Created: 2014-04-21T11:24:51.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-26T10:17:18.000Z (over 9 years ago)
- Last Synced: 2024-08-10T20:32:12.219Z (3 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cascade-stream
==============[![NPM](https://nodei.co/npm/cascade-stream.png?global=true)](https://nodei.co/npm/cascade-stream/)
[![Travis](http://img.shields.io/travis/binocarlos/cascade-stream.svg?style=flat)](https://travis-ci.org/binocarlos/cascade-stream)
A duplex stream that can lazily create child streams from a chunk and merge all outputs into one
## example
```js
var from = require('from2-array')
var through = require('through2')
var cascade = require('cascade-stream')// create a stream for a single letter
function createLetterStream(letter){
return from.obj([1,2,3].map(function(num){
return letter + ':' + num
}))
}var source = from.obj(['a', 'b', 'c'])
var pipeline = cascade(function(chunk, add, next){
add(createLetterStream(chunk))
next()
})var sink = through.obj(function(chunk, enc, cb){
console.log(chunk);
cb()
})source.pipe(pipeline).pipe(sink)
/*a1
a2
a3
b1
b2
b3
c1
c2
c3
*/
```## license
MIT