map-stream-2-limited

0.0.1 • Public • Published

map-stream-2-limited

Limited concurrency map-stream implementation. Inspired by map-stream-limit but built on through2 and additionally allows the concurrency to be changed after instantiation.

Somewhat experimental and likely to be caught out by edge cases...

Install

$ npm install map-stream-2-limited

Usage

var mapLimited = require('map-stream-2-limited')
var transform = mapLimited(function (data, callback) {
  callback(null, data)
 
  // or
 
  callback(new Error('something failed'))
 
}, 10) // initial concurrency limit of 10
 
someStream
.pipe(transform)
 
// Modify concurrency limit by supplying a transform function
transform.changeLimit(function (limit) {
  return limit + 1 // Will throw if you attempt to change the limit to < 1
})
 

License

MIT

© Jon Merrifield

Package Sidebar

Install

npm i map-stream-2-limited

Weekly Downloads

81

Version

0.0.1

License

MIT

Last publish

Collaborators

  • jmerrifield