# leaky-bucket-queue

> An implementation of burstable throtling algorithm on top of rxjs

Latest version **0.0.2** (published 2019-09-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install leaky-bucket-queue
pnpm add leaky-bucket-queue
yarn add leaky-bucket-queue
bun add leaky-bucket-queue
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2019-09-06 |
| First published | 2019-09-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 21.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sean P.L. WONG |
| Maintainers | seanplwong |
| Keywords | leaky, bucket, leaky bucket, leaky-bucket, rate, rate-control, rate-limit, throtle, throtling, queue |

## Links

- npm: https://www.npmjs.com/package/leaky-bucket-queue
- npm.io page: https://npm.io/package/leaky-bucket-queue

## Dependencies (1)

- [rxjs](https://npm.io/package/rxjs.md) ^6.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

- 0.0.2 (latest) — 2019-09-06

## README

# leaky-bucket-queue

An implementation of leaky bucket on top of `rxjs`.

Simple rate limiting are usually good enough for most scenario but they might incur unnecessary stuttering when there is attempt to make multiple call to a server API.
Leaky bucket provides a burstable solution, providing rate limit while allowing bursty traffic,
making application more responsive.

## Installation

```
npm i leaky-bucket-queue
```

## Usage

### Typescript

```ts
import { LeakyBucketQueue } from 'leaky-bucket-queue';

const queue = new LeakyBucketQueue<string>({ burstSize: 5, period: 100 });
queue.consume().subscribe({
  next: console.log,
});
queue.enqueue('compter');
...
```

### JavaScript

```js
import { LeakyBucketQueue } from 'leaky-bucket-queue';

const queue = new LeakyBucketQueue({ burstSize: 5, period: 100 });
queue.consume().subscribe({
  next: console.log,
});
queue.enqueue('explode');
...
```

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