limit-request-promise-native
v0.0.2
Published
Rate-limiting/throttling for limit-request-native
Downloads
2
Maintainers
Readme
limit-request-promise-native
you21979's limit-request-promise library, but with request-promise-native
Getting started
npm install --save request
npm install --save limit-request-promise-native
Usage
var LimitRequestPromiseNative = require('limit-request-promise-native');
var request = new LimitRequestPromiseNative(1,1); // option = default limit
// register database
request.setup([
{
host: 'http://www.example.com',
max: 1000,
sec: 60
},
{
host: 'http://www.yahoo.co.jp',
max: 1,
sec: 1
}
]);
request.req({ url:'http://www.example.com' }).then(console.log); // requests immediately
request.req({ url:'http://www.example.com' }).then(console.log); // requests based on timing settings
request.req('http://www.yahoo.co.jp').then(console.log); // request immediately
request.req('http://www.yahoo.co.jp').then(console.log); // requests 1 second later
License
MIT