Skip to content
Build a limited concurrency through2 stream from an async function
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.jshintrc
.travis.yml
README.md
index.js
package.json
test.js

README.md

map-stream-2-limited

NPM version Build Status

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

You can’t perform that action at this time.