Async-Limiter
Motivation
Example
var Limiter = require('async-limiter')
var t = new Limiter({concurrency: 2});
var results = []
// add jobs using the familiar Array API
t.push(function (cb) {
results.push('two')
cb()
})
t.push(
function (cb) {
results.push('four')
cb()
},
function (cb) {
results.push('five')
cb()
}
)
t.unshift(function (cb) {
results.push('one')
cb()
})
t.splice(2, 0, function (cb) {
results.push('three')
cb()
})
// Jobs run automatically. If you want a callback when all are done,
// call 'onDone()'.
t.onDone(function () {
console.log('all done:', results)
})Zlib Example
Install
Test
API
var t = new Limiter([opts])
var t = new Limiter([opts])Instance methods
t.onDone(fn)
t.onDone(fn)Instance methods mixed in from Array
Arrayt.push(element1, ..., elementN)
t.push(element1, ..., elementN)t.unshift(element1, ..., elementN)
t.unshift(element1, ..., elementN)t.splice(index , howMany[, element1[, ...[, elementN]]])
t.splice(index , howMany[, element1[, ...[, elementN]]])Properties
t.concurrency
t.concurrencyt.length
t.lengthLast updated