first-n-stream

2.0.0 • Public • Published

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

Dependents (1)

Package Sidebar

Install

npm i first-n-stream

Weekly Downloads

10

Version

2.0.0

License

MIT

Last publish

Collaborators

  • cwmma