# @ivanbeldad/timed-queue

> Create a queue to limit async execution in time

Latest version **1.0.1** (published 2018-07-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ivanbeldad/timed-queue
pnpm add @ivanbeldad/timed-queue
yarn add @ivanbeldad/timed-queue
bun add @ivanbeldad/timed-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.1 |
| Published | 2018-07-13 |
| First published | 2018-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Ivan Beldad Fernandez |
| Maintainers | ivanbeldad |
| Keywords | async, timer, queue, handler, request, limit |

## Links

- npm: https://www.npmjs.com/package/@ivanbeldad/timed-queue
- Repository: https://github.com/ivanbeldad/timed-queue
- Homepage: https://github.com/ivanbeldad/timed-queue#readme
- Issues: https://github.com/ivanbeldad/timed-queue/issues
- npm.io page: https://npm.io/package/@ivanbeldad/timed-queue

## Alternatives

- [promise-throttle](https://npm.io/package/promise-throttle.md) — 44.2K weekly downloads
- [@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

## Recent versions

- 1.0.1 (latest) — 2018-07-13
- 1.0.0 — 2018-07-13

## README

# Timed Queue

<p align="center">
  <img src="https://raw.githubusercontent.com/ivanbeldad/timed-queue/master/logo/logo.png">
</p>

[![NPM Version](https://img.shields.io/npm/v/@ivanbeldad/timed-queue.svg)](https://www.npmjs.com/package/@ivanbeldad/timed-queue)
[![License: MIT](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/ivanbeldad/timed-queue/blob/master/LICENSE)

Create a queue to limit async execution in time

## Examples

```javascript
// Execute 5 functions at the same time, but never more than 5 per second.
const queue = require('@ivanbeldad/timed-queue').create({ items: 5, time: 1000 })
```

### Promises approach example

```javascript
queue.add(myPromise)
  .then(result => console.log(`My result after completed! => ${result}`))
  .catch(error => console.error(`Oh no! After all the work it failed! => ${error}`))
```

### Async/Await approach example

```javascript
try {
  const result = await queue.add(myAsyncFunction)
  console.log(`My result after completed! => ${result}`))
} catch (error) {
  console.error(`Oh no! After all the work it failed! => ${error}`))
}
```

## License

Timed Queue is open-sourced software licensed under
the [MIT license](https://github.com/ivanbeldad/timed-queue/blob/master/LICENSE).

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