# limit-async

> An asynchronous process rate limiter that works with promises

Latest version **1.3.0** (published 2017-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install limit-async
pnpm add limit-async
yarn add limit-async
bun add limit-async
```

## 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.3.0 |
| Published | 2017-11-01 |
| First published | 2017-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Taavi Laanemaa |
| Maintainers | tlaanemaa |
| Keywords | limit, limited, limiter, promise, promises, async, asynchronous, concurrency, throttle, rate, ratelimit, queue |

## Links

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

## 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.3.0 (latest) — 2017-11-01
- 1.2.0 — 2017-10-23
- 1.1.5 — 2017-10-22
- 1.1.4 — 2017-10-22
- 1.1.3 — 2017-10-22
- 1.1.2 — 2017-10-22
- 1.1.1 — 2017-10-22
- 1.1.0 — 2017-10-22
- 1.0.2 — 2017-10-21
- 1.0.1 — 2017-10-21
- 1.0.0 — 2017-10-21

## README

# limit-async
An asynchronous process rate limiter that works with promises

One of the core principles when creating this was to give you as much freedom as possible when using it. Thus, it is implemented as a higher order function that will wrap your function and it's promise as transparently as possible. Also, by defining the limit separately, it allows you to apply the same limit to multiple different functions, for example to all HTTP requests (GET, POST, ...).


## Install

```bash
$ npm install --save limit-async
```


## Usage

```javascript
const createLimiter = require('limit-async')

// Will limit to 10 concurrent jobs
const limit = createLimiter(10);

// A sample asynchronous function
// Its basically just a promise wrapper for setTimeout
const myAsyncFunction = value =>
  new Promise(resolve =>
    setTimeout(
      () => resolve(value),
      1000
    ));

for (let i = 0; i < 30; i += 1) {
  // This will print out 0 to 29, 10 values at a time
  limit(myAsyncFunction)(i).then(console.log);
}
```

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