107 lines
6.4 KiB
JSON
107 lines
6.4 KiB
JSON
|
{
|
||
|
"_args": [
|
||
|
[
|
||
|
{
|
||
|
"raw": "async-limiter@~1.0.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "async-limiter",
|
||
|
"name": "async-limiter",
|
||
|
"rawSpec": "~1.0.0",
|
||
|
"spec": ">=1.0.0 <1.1.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom/node_modules/ws"
|
||
|
]
|
||
|
],
|
||
|
"_from": "async-limiter@>=1.0.0 <1.1.0",
|
||
|
"_id": "async-limiter@1.0.0",
|
||
|
"_inCache": true,
|
||
|
"_location": "/async-limiter",
|
||
|
"_nodeVersion": "8.4.0",
|
||
|
"_npmOperationalInternal": {
|
||
|
"host": "s3://npm-registry-packages",
|
||
|
"tmp": "tmp/async-limiter-1.0.0.tgz_1505149068503_0.15003100014291704"
|
||
|
},
|
||
|
"_npmUser": {
|
||
|
"name": "strml",
|
||
|
"email": "samuel.trace.reed@gmail.com"
|
||
|
},
|
||
|
"_npmVersion": "5.4.1",
|
||
|
"_phantomChildren": {},
|
||
|
"_requested": {
|
||
|
"raw": "async-limiter@~1.0.0",
|
||
|
"scope": null,
|
||
|
"escapedName": "async-limiter",
|
||
|
"name": "async-limiter",
|
||
|
"rawSpec": "~1.0.0",
|
||
|
"spec": ">=1.0.0 <1.1.0",
|
||
|
"type": "range"
|
||
|
},
|
||
|
"_requiredBy": [
|
||
|
"/jsdom/ws"
|
||
|
],
|
||
|
"_resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
|
||
|
"_shasum": "78faed8c3d074ab81f22b4e985d79e8738f720f8",
|
||
|
"_shrinkwrap": null,
|
||
|
"_spec": "async-limiter@~1.0.0",
|
||
|
"_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/jsdom/node_modules/ws",
|
||
|
"author": {
|
||
|
"name": "Samuel Reed"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/strml/async-limiter/issues"
|
||
|
},
|
||
|
"dependencies": {},
|
||
|
"description": "asynchronous function queue with adjustable concurrency",
|
||
|
"devDependencies": {
|
||
|
"coveralls": "^2.11.2",
|
||
|
"eslint": "^4.6.1",
|
||
|
"eslint-plugin-mocha": "^4.11.0",
|
||
|
"intelli-espower-loader": "^1.0.1",
|
||
|
"istanbul": "^0.3.2",
|
||
|
"mocha": "^3.5.2",
|
||
|
"power-assert": "^1.4.4"
|
||
|
},
|
||
|
"directories": {},
|
||
|
"dist": {
|
||
|
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
|
||
|
"shasum": "78faed8c3d074ab81f22b4e985d79e8738f720f8",
|
||
|
"tarball": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz"
|
||
|
},
|
||
|
"gitHead": "02c8b498279dc7cc1ecc1c4f6fc9ca320c0ce39b",
|
||
|
"homepage": "https://github.com/strml/async-limiter#readme",
|
||
|
"keywords": [
|
||
|
"throttle",
|
||
|
"async",
|
||
|
"limiter",
|
||
|
"asynchronous",
|
||
|
"job",
|
||
|
"task",
|
||
|
"concurrency",
|
||
|
"concurrent"
|
||
|
],
|
||
|
"license": "MIT",
|
||
|
"maintainers": [
|
||
|
{
|
||
|
"name": "strml",
|
||
|
"email": "samuel.trace.reed@gmail.com"
|
||
|
}
|
||
|
],
|
||
|
"name": "async-limiter",
|
||
|
"optionalDependencies": {},
|
||
|
"readme": "# Async-Limiter\n\nA module for limiting concurrent asynchronous actions in flight. Forked from [queue](https://github.com/jessetane/queue).\n\n[![npm](http://img.shields.io/npm/v/async-limiter.svg?style=flat-square)](http://www.npmjs.org/async-limiter)\n[![tests](https://img.shields.io/travis/STRML/async-limiter.svg?style=flat-square&branch=master)](https://travis-ci.org/STRML/async-limiter)\n[![coverage](https://img.shields.io/coveralls/STRML/async-limiter.svg?style=flat-square&branch=master)](https://coveralls.io/r/STRML/async-limiter)\n\nThis module exports a class `Limiter` that implements some of the `Array` API.\nPass async functions (ones that accept a callback or return a promise) to an instance's additive array methods.\n\n## Motivation\n\nCertain functions, like `zlib`, have [undesirable behavior](https://github.com/nodejs/node/issues/8871#issuecomment-250915913) when\nrun at infinite concurrency.\n\nIn this case, it is actually faster, and takes far less memory, to limit concurrency.\n\nThis module should do the absolute minimum work necessary to queue up functions. PRs are welcome that would\nmake this module faster or lighter, but new functionality is not desired.\n\nStyle should confirm to nodejs/node style.\n\n## Example\n\n``` javascript\nvar Limiter = require('async-limiter')\n\nvar t = new Limiter({concurrency: 2});\nvar results = []\n\n// add jobs using the familiar Array API\nt.push(function (cb) {\n results.push('two')\n cb()\n})\n\nt.push(\n function (cb) {\n results.push('four')\n cb()\n },\n function (cb) {\n results.push('five')\n cb()\n }\n)\n\nt.unshift(function (cb) {\n results.push('one')\n cb()\n})\n\nt.splice(2, 0, function (cb) {\n results.push('three')\n cb()\n})\n\n// Jobs run automatically. If you want a callback when all are done,\n// call 'onDone()'.\nt.onDone(function () {\n console.log('all done:', results)\n})\n```\n\n## Zlib Example\n\n```js\nconst zlib = require('zlib');\nconst Limiter = require('async-limiter');\n\nconst message = {some: \"data\"};\nconst payload = new Buffer(JSON.stringify(message));\n\n// Try with different concurrency values to see how this actually\n// slows significantly with higher concurrency!\n//\n// 5: 1398.607ms\n// 10: 1375.668ms\n// Infinity: 4423.300ms\n//\nconst t = new Limiter({concurrency: 5});\nfunction deflate(payload, cb) {\n t.push(function(done) {\n zlib.deflate(payload, function(err, buffer) {\n done();\n cb(err, buffer);\n });\n });\n}\n\nconsole.time('deflate');\nfor(let i = 0; i < 30000; ++i) {\n deflate(payload, function (err, buffer) {});\n}\nq.onDone(function() {\n console.timeEnd('deflate');\n});\n```\n\n## Install\n\n`npm install async-limiter`\n\n## Test\n\n`npm test`\n\n## API\n\n### `var t = new Limiter([opts])`\nConstructor. `opts` may contain inital values for:\n* `q.concurrency`\n\n## Instance methods\n\n### `q.onDone(fn)`\n`fn` will be called once and only once, when the queue is empty.\n\n## Instance methods mixed in from `Array`\nMozilla has docs on how these methods work [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array).\n### `q.push(element1, ..., elementN)`\n### `q.unshift(element1, ..., elementN)`\n### `q.splice(index , howMany[, element1[, ...[, elementN]]])`\n\n## Properties\n### `q.concurrency`\nMax number of jobs the queue should process concurrently, defaults to `Infinity`.\n\n### `q.length`\nJobs pending + jobs to process (readonly).\n\n",
|
||
|
"readmeFilename": "readme.md",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git+https://github.com/strml/async-limiter.git"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"coverage": "istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls",
|
||
|
"example": "node example",
|
||
|
"lint": "eslint .",
|
||
|
"test": "mocha --R intelli-espower-loader test/",
|
||
|
"travis": "npm run lint && npm run coverage"
|
||
|
},
|
||
|
"version": "1.0.0"
|
||
|
}
|