Skip to content

Latest commit

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

flow-quantiles

Reduce transform stream which computes the quantiles over a stream of numeric data.

Note: in order to calculate the quantiles exactly, all data must be buffered into memory. As a result, this stream acts as a sink. Use caution when applying the transform to large datasets.

Installation

$ npm install flow-quantiles

Examples

vareventStream=require('event-stream'),qStream=require('flow-quantiles');// Create some data...vardata=newArray(1000);for(vari=0;i<data.length;i++){data[i]=Math.round(Math.random()*100);}// Create a readable stream:varreadStream=eventStream.readArray(data);// Create a new quantiles stream:varstream=qStream().quantiles(10).stream();// Pipe the data:readStream.pipe(stream).pipe(eventStream.stringify()).pipe(process.stdout);

Tests

Unit tests use the Mocha test framework with Chai assertions.

Assuming you have 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

MIT license.


Copyright

Copyright © 2014. Athan Reines.

About

Reduce transform stream which calculates the quantiles of streamed data.

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages