# array-async-queue

> Asynchronously go through an array with concurrency and queue

Latest version **1.0.7** (published 2021-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-async-queue
pnpm add array-async-queue
yarn add array-async-queue
bun add array-async-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.7 |
| Published | 2021-09-09 |
| First published | 2018-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=5.0.0 |
| Dependencies | 2 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Alexander Balasyan |
| Maintainers | ortex |
| Keywords | chunk, array, async, big, loop, queue, concurrency, concurrent |

## Links

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

## Dependencies (2)

- [husky](https://npm.io/package/husky.md) ^4.3.8
- [browserify](https://npm.io/package/browserify.md) ^16.5.2

## 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.7 (latest) — 2021-09-09
- 1.0.6 — 2021-06-05
- 1.0.5 — 2021-04-05
- 1.0.4 — 2021-03-19
- 1.0.3 — 2020-07-18
- 1.0.2 — 2020-03-22
- 1.0.1 — 2018-12-28
- 1.0.0 — 2018-12-02
- 0.0.1 — 2018-12-02

## README

# Install
`npm install array-async-queue`

# About
Asynchronously go through an array with concurrency and queue

# Example

```js
const arrayAsyncQueue = require("array-async-queue");
const arr = [];
const concurrency = 10;

for (let i = 0; i < 1000; i++) {
  arr.push(i);
}

function getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min)) + min;
}

arrayAsyncQueue(arr, concurrency, (val, stop) => {
  console.log(val);

  if(getRandomInt(0, 100) >= 99) {
    // stop the queue if necessary
    return stop();
  }

  return new Promise(resolve => setTimeout(resolve, getRandomInt(0, 50))
})
```

# Description
Initially, the functions will be launched in parallel in the quantity specified in the variable __concurrency__. After completing one of them, the next one remaining in the array will be called. At the same time, the number of parallel called functions is always equal to __concurrency__.

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