flow-cmean
Transform stream factory to calculate arithmetic means for streamed data arrays (chunks).
Installation
$ npm install flow-cmean
API
To create a stream factory,
var meanStream = ;// Create a new factory:var mStream = ;
mStream.stream()
To create a new mean stream,
var stream = mStream;
Usage
Methods are chainable.
;
Examples
var eventStream =chunkStream =mStream = ;// Create some data...var data = 1000 ;for var i = 0; i < datalength; i++data i = Math;// Create a readable stream:var readStream = eventStream;// Create a new chunkify stream (chunk the data into groups of 100; i.e., 10 chunks):var cStream =;// Create a new mean 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.