0.0.1 • Published 10 years ago

map-stream-2-limited v0.0.1

Weekly downloads
185
License
MIT
Repository
github
Last release
10 years ago

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