{"_id":"p-throttler","_rev":"143664","name":"p-throttler","description":"A promise based throttler capable of limiting execution of parallel tasks","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"time":{"modified":"2021-06-03T11:28:29.000Z","created":"2013-05-27T21:43:24.318Z","1.0.2":"2016-01-03T09:54:20.241Z","1.0.1":"2016-01-02T18:38:59.396Z","1.0.0":"2016-01-02T18:36:24.237Z","0.1.1":"2014-09-08T00:20:55.030Z","0.1.0":"2014-09-07T23:46:27.464Z","0.0.1":"2013-05-27T21:43:24.318Z"},"users":{"carsy":true},"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler.git"},"versions":{"1.0.2":{"name":"p-throttler","version":"1.0.2","description":"A promise based throttler capable of limiting execution of parallel tasks","main":"index.js","devDependencies":{"expect.js":"^0.3.1","mocha":"^2.1.0"},"scripts":{"test":"mocha -R spec --bail"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler.git"},"bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"keywords":["promise","throttler","trottle","deferred","worker","tasks","parallel"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","engines":{"node":">=0.12"},"gitHead":"f9992e304492a74ba2e00480cc520ec69b6d1feb","homepage":"https://github.com/IndigoUnited/node-p-throttler#readme","_id":"p-throttler@1.0.2","_shasum":"4034d39f5ad0dcf0cf9f1fc4463d5a80ed236672","_from":".","_npmVersion":"2.14.9","_nodeVersion":"0.12.9","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"4034d39f5ad0dcf0cf9f1fc4463d5a80ed236672","size":5470,"noattachment":false,"key":"/p-throttler/-/p-throttler-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-throttler/download/p-throttler-1.0.2.tgz"},"directories":{},"publish_time":1451814860241,"_cnpm_publish_time":1451814860241,"_hasShrinkwrap":false},"1.0.1":{"name":"p-throttler","version":"1.0.1","description":"A promise based throttler capable of limiting execution of parallel tasks","main":"index.js","dependencies":{"promise":"^7.1.1"},"devDependencies":{"expect.js":"^0.3.1","mocha":"^2.1.0"},"scripts":{"test":"mocha -R spec --bail"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler.git"},"bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"keywords":["promise","throttler","trottle","deferred","worker","tasks","parallel"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","gitHead":"67537e9dbc0ffec57306fce485561ec915a2ea6e","homepage":"https://github.com/IndigoUnited/node-p-throttler#readme","_id":"p-throttler@1.0.1","_shasum":"250cf451b29e5c8cdcd3ade05a8a363f0f4272ba","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"250cf451b29e5c8cdcd3ade05a8a363f0f4272ba","size":5458,"noattachment":false,"key":"/p-throttler/-/p-throttler-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-throttler/download/p-throttler-1.0.1.tgz"},"directories":{},"publish_time":1451759939396,"_cnpm_publish_time":1451759939396,"_hasShrinkwrap":false},"1.0.0":{"name":"p-throttler","version":"1.0.0","description":"A promise based throttler capable of limiting execution of parallel tasks","main":"index.js","dependencies":{"promise":"^7.1.1"},"devDependencies":{"expect.js":"^0.3.1","mocha":"^2.1.0"},"scripts":{"test":"mocha -R spec --bail"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler.git"},"bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"keywords":["promise","throttler","trottle","deferred","worker","tasks","parallel"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","gitHead":"5739cb81ede70f0e8f3aca08bf724f884c2df62d","homepage":"https://github.com/IndigoUnited/node-p-throttler#readme","_id":"p-throttler@1.0.0","_shasum":"a9566dd85be89afcf7a3ab5e9dc5975622545aea","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.3","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"a9566dd85be89afcf7a3ab5e9dc5975622545aea","size":5452,"noattachment":false,"key":"/p-throttler/-/p-throttler-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-throttler/download/p-throttler-1.0.0.tgz"},"directories":{},"publish_time":1451759784237,"_cnpm_publish_time":1451759784237,"_hasShrinkwrap":false},"0.1.1":{"name":"p-throttler","version":"0.1.1","description":"A promise based throttler capable of limiting execution of parallel tasks","main":"index.js","dependencies":{"q":"~0.9.2"},"devDependencies":{"mocha":"~1.10.0","expect.js":"~0.2.0"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler"},"bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"keywords":["promise","throttler","trottle","deferred","worker","tasks","parallel"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","homepage":"https://github.com/IndigoUnited/node-p-throttler","_id":"p-throttler@0.1.1","_shasum":"15246409d225d3eefca85c50de710a83a78cca6a","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"15246409d225d3eefca85c50de710a83a78cca6a","size":5156,"noattachment":false,"key":"/p-throttler/-/p-throttler-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-throttler/download/p-throttler-0.1.1.tgz"},"directories":{},"publish_time":1410135655030,"_cnpm_publish_time":1410135655030,"_hasShrinkwrap":false},"0.1.0":{"name":"p-throttler","version":"0.1.0","description":"A promise based throttler capable of limiting execution of parallel tasks","main":"index.js","dependencies":{"q":"~0.9.2"},"devDependencies":{"mocha":"~1.10.0","expect.js":"~0.2.0"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler"},"bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"keywords":["promise","throttler","trottle","deferred","worker","tasks","parallel"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","homepage":"https://github.com/IndigoUnited/node-p-throttler","_id":"p-throttler@0.1.0","_shasum":"1b16907942c333e6f1ddeabcb3479204b8c417c4","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"dist":{"shasum":"1b16907942c333e6f1ddeabcb3479204b8c417c4","size":5158,"noattachment":false,"key":"/p-throttler/-/p-throttler-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-throttler/download/p-throttler-0.1.0.tgz"},"directories":{},"publish_time":1410133587464,"_cnpm_publish_time":1410133587464,"_hasShrinkwrap":false},"0.0.1":{"name":"p-throttler","version":"0.0.1","description":"A promise based throttler capable of limiting execution of parallel tasks","main":"index.js","dependencies":{"q":"~0.9.2"},"devDependencies":{"mocha":"~1.10.0","expect.js":"~0.2.0"},"scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git://github.com/IndigoUnited/node-p-throttler"},"bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"keywords":["promise","throttler","trottle","deferred","worker","tasks","parallel"],"author":{"name":"IndigoUnited","email":"hello@indigounited.com","url":"http://indigounited.com"},"license":"MIT","readmeFilename":"README.md","_id":"p-throttler@0.0.1","dist":{"shasum":"c341e3589ec843852a035e6f88e6c1e96150029b","size":5064,"noattachment":false,"key":"/p-throttler/-/p-throttler-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/p-throttler/download/p-throttler-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"satazor","email":"andremiguelcruz@msn.com"},"maintainers":[{"name":"satazor","email":"andremiguelcruz@msn.com"}],"directories":{},"publish_time":1369691004318,"_cnpm_publish_time":1369691004318,"_hasShrinkwrap":false}},"readme":"# p-throttler\n\n[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]\n\n[npm-url]:https://npmjs.org/package/p-throttler\n[downloads-image]:http://img.shields.io/npm/dm/p-throttler.svg\n[npm-image]:http://img.shields.io/npm/v/p-throttler.svg\n[travis-url]:https://travis-ci.org/IndigoUnited/node-p-throttler\n[travis-image]:http://img.shields.io/travis/IndigoUnited/node-p-throttler.svg\n[david-dm-url]:https://david-dm.org/IndigoUnited/node-p-throttler\n[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-p-throttler.svg\n[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-p-throttler#info=devDependencies\n[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-p-throttler.svg\n\nA promise based throttler responsible for limiting execution of parallel tasks.\nThe number of parallel tasks may be limited and configured per type.\n\n\n## Installation\n\n`$ npm install p-throttler`\n\n\n## API\n\n### #create(defaultConcurrency, types)\n\nConstructs a new throttler.\n\nThe `defaultConcurrency` is the default maximum concurrent functions being run (-1 to specify no limits).   \nThe `types` allows you to specify different concurrencies for different types.   \n\nExample:\n\n```js\nvar throttler = PThrottler.create(15, {  // or new PThrottler()\n    'network_io': 10,\n    'disk_io': 50\n});\n```\n\n\n### .enqueue(func, [type]): Promise\n\nEnqueues a function to be ran. The function is expected to return a promise or a value.   \nThe returned promise is resolved when the function finishes execution.\n\nThe `type` argument is optional and can be a `string` or an array of `strings`.   \nUse it to specify the type(s) associated with the function.   \n\nThe function will run as soon as a free slot is available for every `type`.  \nIf no `type` is passed or is unknown, the `defaultConcurrency` is used.  \n\nThe execution order is guaranteed for functions enqueued with the exact same `type` argument.\n\nExample:\n\n```js\n\nvar method = function () {\n    return Q.resolve('foo');\n};\n\nvar throttler = PThrottler.create(15, {\n    'foo': 1,\n    'bar': 2\n});\n\n// Single type, will only run when a free slot for\n// \"foo\" is available\nthrottler.enqueue(function () {\n    return method();    // method() returns some promise\n}, 'foo')\n.then(function (value) {\n    console.log(value);\n});\n\n// Multiple type, will only run when a free slot for\n// \"foo\" and \"bar\" are available\nthrottler.enqueue(function () {\n    return method();    // method() returns some promise\n}, ['foo', 'bar'])\n.then(function (value) {\n    console.log(value);\n});\n```\n\n\n### .abort(): Promise\n\nAborts all current work being done.\nReturns a promise that is resolved when the current running functions finish to execute.   \nAny function that was in the queue waiting to be ran is removed immediately.\n\n\n## License\n\nReleased under the [MIT License](http://www.opensource.org/licenses/mit-license.php).\n","_attachments":{},"homepage":"https://github.com/IndigoUnited/node-p-throttler#readme","bugs":{"url":"http://github.com/IndigoUnited/node-p-throttler/issues"},"license":"MIT"}