Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dbkaplun/rate-limit-promise

Return a promise that is resolved as more requests can be made
https://github.com/dbkaplun/rate-limit-promise

Last synced: 28 days ago
JSON representation

Return a promise that is resolved as more requests can be made

Awesome Lists containing this project

README

        

# rate-limit-promise [![Build Status](https://travis-ci.org/dbkaplun/rate-limit-promise.svg?branch=master)](https://travis-ci.org/dbkaplun/rate-limit-promise)
Return a promise that is resolved as more requests can be made

## Installation

```sh
$ npm install rate-limit-promise
```

## Usage

```js
const rateLimit = require('rate-limit-promise')

let request = rateLimit(1, 1000) // 1 request per 1000ms = 1 second
Promise.all([request(), request(), request()]).then(() => {
console.log("2 seconds have passed")
})
```