node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

popsicle-limit

Popsicle Limit

NPM version NPM downloads Build status Test coverage

Transparently handle API rate limiting with Popsicle.

Installation

npm install popsicle-limit --save

Usage

var request = require('popsicle')
var limit = require('popsicle-limit')
 
// Limit request to 5000/hr. 
var requestLimit = limit(5000, limit.HOUR)
 
request('/users.json')
  .use(requestLimit)
 
console.log(limit.SECOND) //=> 1000 
console.log(limit.MINUTE) //=> 60000 
console.log(limit.HOUR)   //=> 3600000 
console.log(limit.DAY)    //=> 86400000 
console.log(limit.WEEK)   //=> 604800000 

License

MIT