# notsofast

> A promise based rate limiter with configurable timeouts

Latest version **1.0.1** (published 2016-05-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install notsofast
pnpm add notsofast
yarn add notsofast
bun add notsofast
```

## 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 | 2016-05-20 |
| First published | 2016-05-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kristjan Tammekivi |
| Maintainers | ktammekivi |
| Keywords | rate, limiter |

## Links

- npm: https://www.npmjs.com/package/notsofast
- Repository: https://github.com/KristjanTammekivi/NotSoFast
- Homepage: https://github.com/KristjanTammekivi/NotSoFast#readme
- Issues: https://github.com/KristjanTammekivi/NotSoFast/issues
- npm.io page: https://npm.io/package/notsofast

## Dependencies (2)

- [bluebird](https://npm.io/package/bluebird.md) ^3.3.5
- [subclass-error](https://npm.io/package/subclass-error.md) ^0.1.1

## Recent versions

- 1.0.1 (latest) — 2016-05-20
- 1.0.0 — 2016-05-20

## README

NotSoFast
=========

A simple promise based rate limiter.

Usage
-----

    notsofast = require('notsofast')(options);

    notsofast()
        .then(function () {
            console.log('I can now do what I wanted to do!');
        })
        .catch(function () {
            console.log('Nope, no can do!');
        });

Options
-------

* **timeout** (*integer*) - Milliseconds before unresolved promises get rejected. Defaults to 5000
* **interval** (*integer*) - Milliseconds. Interval at which new tickets are loaded. Defaults to 1000
* **ticketsPerInterval** (*integer*) - Amount of tickets that will be redeemable per interval.
* **bucketSize** (*integer*) - Amount of tickets the bucket can hold before it instantly starts rejecting promises. Defaults to ticketsPerInterval


Error predicates
----------------

NotSoFast is based on bluebird, so you can catch errors with predicates.

    notsofast = require('notsofast')(options);

    notsofast()
        .then(doMyTask)
        .catch(notsofast.timeoutError, function () {
            // Ticket timed out
        })
        .catch(notsofast.bucketFullError, function () {
            // Bucket is full
        })
        .catch(console.log);

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