first-n-stream
v2.0.0
Published
take the first n objects from a stream
Downloads
22
Readme
first-n-stream
A passthough objectMode stream that diverts the first n entries into either another stream or a callback
npm install --save first-n-stream
API
var FirstN = require('first-n-stream');
var withCallback = new FirstN(5, function (err, resp) {
// resp will be an array of the first 5 items
});
something.pipe(withCallback).pipe(streamThatWillGetTheRest);
var withStream = new FirstN(5, streamThatWillGetTheFirst5);
something.pipe(withStream).pipe(streamThatWillGetTheRest);
license
MIT