0.0.2 • Published 9 years ago

q-ratelimit v0.0.2

Weekly downloads
7
License
-
Repository
github
Last release
9 years ago

q-ratelimit

NPM Version NPM Downloads Build Status Coverage Status Dependency Status devDependency Status

Rate limiting (throttling) implementation for Q promises on Node.js

Install: npm install q-ratelimit

Limit frequency of promise fulfilling:

var throttle = require('q-ratelimit')(2000); /* rateInMilliseconds */

var startTime = Date.now();

for (var i = 0; i < 10; i++) {
	throttle().then(function() { console.log(Date.now() - startTime); }).done();
}

// example output:
// 11
// 2007
// 4007
// 6008
// 8011
// 10014
// 12016
// 14018
// 16020
// 18022

License

MIT

0.0.2

9 years ago

0.0.1

9 years ago