flow-sink-and-stream
Transform stream factory to sink a specified number of streamed data values and then stream new data values as they arrive.
Installation
$ npm install flow-sink-and-stream
API
To create a stream factory,
var sasStream = ;// Create a new factory:var tStream = ;
tStream.numValues( [numValues] )
This method is a setter/getter. If no numValues
is provided, returns the numValues
to initially sink; default is 0
. To set the numValues
,
tStream;
tStream.stream()
To create a new sink-and-stream stream,
var stream = tStream;
Usage
Methods are chainable.
;
Examples
var eventStream =tStream = ;// Create some data...var data = 20 ;for var i = 0; i < datalength; i++data i = Math;// Create a readable stream:var readStream = eventStream;// Create a new sink-and-stream stream:var stream =;// Pipe the data:readStream;
To run the example code from the top-level application directory,
$ node ./examples/index.js
Tests
Unit tests use the Mocha test framework with Chai assertions.
Assuming you have globally installed Mocha, execute the following command in the top-level application directory to run the tests:
$ mocha
All new feature development should have corresponding unit tests to validate correct functionality.
License
Copyright
Copyright © 2014. Athan Reines.