Skip to content

mcuppi/axios-rate-limit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axios-rate-limit

npm version npm downloads Build Status

A rate limit for axios: set how many requests per interval should perform immediately, other will be delayed automatically.

Installing

yarn add axios-rate-limit

Usage

import axios from 'axios';
import rateLimit from 'axios-rate-limit';

// sets max 2 requests per 1 second, other will be delayed
const http = rateLimit(axios.create(), { maxRequests: 2, perMilliseconds: 1000 });
http.get('https://example.com/api/v1/users.json?page=1') // will perform immediately
http.get('https://example.com/api/v1/users.json?page=2') // will perform immediately
http.get('https://example.com/api/v1/users.json?page=3') // will perform after 1 second from the first one

A bit of advertising :-)

Since 2010 lead my own software development company Cifronomika. We doing Ruby on Rails and JavaScript development. Feel free to contact

About

Rate limit for axios

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%