basic-queue

a basic queue with concurrency

npm install basic-queue
12 downloads in the last day
100 downloads in the last week
197 downloads in the last month

basic-queue

example

var Queue = require('./queue');
var q = new Queue(request, concurrency / numWorkers);

function request() {
    q.add();
}

api

q = Queue(callback, concurrency)

callback is the function that this queue runs. Concurrency is how many simultaneous jobs should run of that function. callback will receive object and callback as arguments. If callback is a call with an error as a first argument, the queue will emit an error event.

q.add()

Tell the queue to start a new job if it isn't over the concurrency limit.

npm loves you