# promiseq

> Promise queue for Node.js

Latest version **1.1.0** (published 2019-01-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install promiseq
pnpm add promiseq
yarn add promiseq
bun add promiseq
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2019-01-24 |
| First published | 2014-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Nullivex |
| Maintainers | nullivex |
| Keywords | promise, queue, q, bluebird, async, migration |

## Links

- npm: https://www.npmjs.com/package/promiseq
- Repository: https://github.com/snailjs/promiseq
- Homepage: https://www.nullivex.com/
- Issues: https://github.com/snailjs/promiseq/issues
- npm.io page: https://npm.io/package/promiseq

## Dependencies (2)

- [async](https://npm.io/package/async.md) 2.6.x
- [bluebird](https://npm.io/package/bluebird.md) 3.5.x

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2019-01-24
- 1.0.0 — 2018-10-06
- 0.1.0 — 2014-10-16

## README

PromiseQ [![Build Status](https://travis-ci.org/nullivex/promiseq.png?branch=master)](https://travis-ci.org/nullivex/promiseq)
========

Promise queue for node.js

This package will maintain a queue of promises and use promises to return
completion of a task as well as completion of the queue.

Useful for migrations and work queues. This is inspired by `promise-queue` but
built for Node.js and uses `bluebird` to provide the promises and `async.queue`
to facilitate the queue operations.

## Usage

```js
var P = require('bluebird') //or whatever promise library you prefer such as `Q`
var PromiseQueue = require('promiseq')
var workerCount = 4 //defaults to number of cpus when left null

//setup the queue
var queue = new PromiseQueue(workerCount)

//make a job
var job = function(){
  return new P(function(resolve){
    process.nextTick(resolve)
  })
}

//add a single job
queue.push(job).then(function(){console.log('Job complete')})

//close the queue and listen for the drain
queue.close().then(function(){console.log('Queue closed and drained')})
```

## Changelog

### 1.1.0
* Deprecated the `processed` stat in favor of `complete`
* Added `failed` stat that tracks error counts
* Added `succeeded` stat which is (`complete` - `failed`)

### 1.0.0
* Update dependencies
* Add `canAccept()` function to queue to see if slots are available
* Add `allowance` to allow overloading of `canAccept()` function
* Fix bug related to definition of total slots
* Update license and distributor details

### 0.1.0
* Initial release

---
_Source: https://npm.io/package/promiseq · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
