# async-parallel-queue

> Execute a queue of async functions in parallel

Latest version **1.0.3** (published 2021-05-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install async-parallel-queue
pnpm add async-parallel-queue
yarn add async-parallel-queue
bun add async-parallel-queue
```

## 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.0.3 |
| Published | 2021-05-15 |
| First published | 2021-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Hitesh Khandelwal |
| Maintainers | hkk12369 |
| Keywords | async-parallel-queue, parallel-queue, concurrent-queue, async-parallel, async, queue |

## Links

- npm: https://www.npmjs.com/package/async-parallel-queue
- Repository: https://github.com/hkk12369/async-parallel-queue
- Homepage: https://github.com/hkk12369/async-parallel-queue#readme
- Issues: https://github.com/hkk12369/async-parallel-queue/issues
- npm.io page: https://npm.io/package/async-parallel-queue

## Dependencies (1)

- [denque](https://npm.io/package/denque.md) ^1.5.0

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.3 (latest) — 2021-05-15
- 1.0.2 — 2021-05-14
- 1.0.1 — 2021-05-14
- 1.0.0 — 2021-05-14

## README

## async-parallel-queue
Execute a queue of async functions in parallel.

## Install
```sh
npm install async-parallel-queue
# OR
yarn add async-parallel-queue
```

## Docs

```js
const Queue = require('async-parallel-queue');

// create a queue with 10 concurrency (10 tasks will run in parallel)
const queue = new Queue({concurrency: 10});

// add any async function to the queue, it'll run automatically in parallel with given concurrency
queue.add(async () => fetch('https://www.google.com'));
queue.add(async () => fetch('https://www.facebook.com'));

// use ignore result option if you don't care about the result
queue.add(async () => doThing(), {ignoreResult: true});

// you can use await if you need the result immediately
const res1 = await queue.add(async () => { ... });

// you can also supply arguments to the function
queue.add(async (a, b) => a + b, {args: [1, 2]});

// if you want to call the same function many times, use queue.fn
const download = queue.fn(async (url) => fetch(url));
fn('https://www.google.com');
fn('https://www.facebook.com');
const res2 = await fn('https://www.twitter.com');

// you can use ignore result with queue.fn
const download = queue.fn(async () => { ... }, {ignoreResult: true});

// when you are done adding things, wait for queue to be idle (otherwise some tasks may be incomplete)
await queue.waitIdle();

// you can pause the queue
queue.pause();
// see if queue is paused
queue.isPaused ? 'paused' : 'not paused';
// start / resume the queue
queue.start();
// get number of items in the queue
queue.length;
```

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