worq

2.1.2 • Public • Published

worq

Promising job queue

Run promises in series or with a configurable concurrency limit

Build Status Code Quality Code Coverage NPM Version

Install

$ npm install --save worq

Usage

const Queue = require('worq');
 
let queue = new Queue();
 
queue.run([
 
    () => somePromisingFunction(),
    () => someOtherPromisingFunction(),
    () => someNormalFunction()
    
    // these functions will be executed in series
    
]).then(results => {
 
    // results will be an array containing the return / fulfillment values
    
});

API

Queue([options])

options

concurrency

Type: number Default: 1

The maximum number of jobs that can run simultaneously

Queue.run(jobs)

jobs

Type: Function[]

An array of jobs. Jobs may return/throw regularly or return a promise.

Returns a promise for an array containing the fulfillment values in the same order.

Queue.cancel()

Cancels the remaining jobs.

License

MIT © JM Versteeg

dependency Status devDependency Status

Package Sidebar

Install

npm i worq

Weekly Downloads

11

Version

2.1.2

License

MIT

Last publish

Collaborators

  • jmversteeg