A streaming interface to reservoir sampling

npm install reservoir-stream
2 downloads in the last week
8 downloads in the last month

reservoir-streambuild status

A streaming interface to do reservoir sampling by using the great reservoir module.


npm install reservoir-stream


// use a reservoir size of 3
var stream = require('reservoir-stream')(3)

var inputStream.pipe(stream).pipe(outputStream)
// 3 random elements from the inputStream will be piped to the outputStream
npm loves you