Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/stagas/fun-stream

functional streams decorator
https://github.com/stagas/fun-stream

Last synced: 14 days ago
JSON representation

functional streams decorator

Awesome Lists containing this project

README

        

# fun-stream

functional streams decorator

## Example

```js
var fun = require('fun-stream');
var Stream = require('stream');

function createStream(){
var stream = new Stream;
stream.readable = true

var count = 0;
var interval = setInterval(function(){
stream.emit('data', count);
if (5 == ++count) {
stream.emit('end');
clearInterval(interval);
}
}, 1000);

return stream;
}

var stdout = fun(process.stdout);
var stream = fun(createStream());

stdout(stream);
```

## License

MIT