node-streamify
Streamify helps you easily provide a streaming interface for your code.
Usage
const streamify = ;const request = ; exports { let stream = ; ; // Your function can return back a stream!! return stream;} // Because `doSomething()` returns a stream, it can be piped.exports;
API
streamify([options])
Returns an instance of a stream. options
can be
readable
- Defaults totrue
.writable
- Defaults totrue
.
Stream#resolve(stream)
Must be called only once when the actual stream you are proxying to becomes available after an asynchronous operation.
Stream#unresolve()
Can be used to unbind a a resolved stream to later call resolve()
again.
Stream#addSource(stream)
Add a source readable stream.
Stream#removeSource()
Remove previously added source stream.
Stream#addDest(stream)
Add a destination writable stream.
Stream#removeDest()
Remove a previously added destination stream.
Install
npm install streamify
Tests
Tests are written with mocha
npm test