npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

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

install

npm i worq

Downloadsweekly downloads

43

version

2.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability