Newts Parading Majestically

    promise-ratelimit

    0.0.3 • Public • Published

    promise-ratelimit

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

    Rate limiting (throttling) implementation for Promises on Node.js

    Install: npm install promise-ratelimit

    Limit frequency of promise fulfilling:

    var throttle = require('promise-ratelimit')(2000); /* rateInMilliseconds */
     
    var startTime = Date.now();
     
    for (var i = 0; i < 10; i++) {
        throttle().then(function() { console.log(Date.now() - startTime); });
    }
     
    // example output:
    // 11
    // 2007
    // 4007
    // 6008
    // 8011
    // 10014
    // 12016
    // 14018
    // 16020
    // 18022

    License

    MIT

    Note: q-ratelimit and promise-ratelimit are sister modules based on the same original code.

    Keywords

    none

    Install

    npm i promise-ratelimit

    DownloadsWeekly Downloads

    548

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • addaleax