mirror of
https://github.com/denoland/deno.git
synced 2025-01-12 00:54:02 -05:00
1 line
5.5 KiB
JSON
1 line
5.5 KiB
JSON
{"name":"p-limit","description":"Run multiple promise-returning & async functions with limited concurrency","dist-tags":{"latest":"2.3.0"},"versions":{"2.3.0":{"name":"p-limit","version":"2.3.0","description":"Run multiple promise-returning & async functions with limited concurrency","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-limit.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava && tsd-check"},"dependencies":{"p-try":"^2.0.0"},"devDependencies":{"ava":"^1.2.1","delay":"^4.1.0","in-range":"^1.0.0","random-int":"^1.0.0","time-span":"^2.0.0","tsd-check":"^0.3.0","xo":"^0.24.0"},"gitHead":"a11f02bc5c04490b7c3de2663d866c211fb915ea","bugs":{"url":"https://github.com/sindresorhus/p-limit/issues"},"_id":"p-limit@2.3.0","_nodeVersion":"10.19.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==","shasum":"3dd33c647a214fdfffd835933eb086da0dc21db1","tarball":"http://localhost:4260/p-limit/p-limit-2.3.0.tgz","fileCount":5,"unpackedSize":7390,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeifv9CRA9TVsSAnZWagAAC1oQAJgu/ArafOjG7TW97Uxj\n3Y5d+GdiC6Fr40sWDExogt4uS350422jaisNcfU0W0tlucaPqY1OabpASQbe\ntUOGGJWynBIGSgZuLwQslIsXEzcEBxiFj6hC7CtmWAbeFJVuCLAeBIuMXbLS\nBQSzx3z2dJCF/n5ttBJw5CyRSejMKdu/52XgHZzi3Nfdd+IxQMIL9b4Pit2Y\nNljkobCSaSKSKXZE1hd466v5bpifLNjoxQGiag4mFPOPFOvX3uqhvBPyQDLn\nyNCC70Kc4UHGVFA7gnBHgX4YcMyj2HG4FyrrRGtg3OepeOYnIoymKBjHpSzJ\nmLCjN4LO/zaSJC624//GfMzganoYehGNVbz5H080iRa4lashXgEQexQBjdt4\n5Ef0H4FbKbKVyXCBt5gPkdHwhGIVb1iaXysghXQFCkSkCWtjhreVh0VhQ/+D\nOSnoMxeJDLKN5YMpa7GkvNOdxOlkNAKX4ZSA509Bwkx4Y8fKewRjLRNwjsGm\n6vXNVay6B48uhCJvupE0SCXr1+Xe/7aFSrrem80daFyMKAbgGaZ2YBcVjIUJ\na5dfD2Q6bm5L4Zpm0r5qsDgAaqQ93kUZnDRYTe/thkJuJYPO7JiL+OknPk/e\nkgCFHZH/cqeK3YSP0eor+u3UyvhTqG/Jsp261YEtBe1go2gbW6zY/TQrzbrH\n3EKE\r\n=JEtU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHlt9hYbHxGW7zloRi9Qq0+GXUbc70zfkBA1JDaXzzryAiEA7VoBzXgYGN4f5jYZPmlarzfWIuqRoF0Kn9YzC4aGzNE="}]},"directories":{},"_hasShrinkwrap":false}},"readme":"# p-limit\n\n> Run multiple promise-returning & async functions with limited concurrency\n\n## Install\n\n```\n$ npm install p-limit\n```\n\n## Usage\n\n```js\nimport pLimit from 'p-limit';\n\nconst limit = pLimit(1);\n\nconst input = [\n\tlimit(() => fetchSomething('foo')),\n\tlimit(() => fetchSomething('bar')),\n\tlimit(() => doSomething())\n];\n\n// Only one promise is run at once\nconst result = await Promise.all(input);\nconsole.log(result);\n```\n\n## API\n\n### pLimit(concurrency)\n\nReturns a `limit` function.\n\n#### concurrency\n\nType: `number`\\\nMinimum: `1`\\\nDefault: `Infinity`\n\nConcurrency limit.\n\n### limit(fn, ...args)\n\nReturns the promise returned by calling `fn(...args)`.\n\n#### fn\n\nType: `Function`\n\nPromise-returning/async function.\n\n#### args\n\nAny arguments to pass through to `fn`.\n\nSupport for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a *lot* of functions.\n\n### limit.activeCount\n\nThe number of promises that are currently running.\n\n### limit.pendingCount\n\nThe number of promises that are waiting to run (i.e. their internal `fn` was not called yet).\n\n### limit.clearQueue()\n\nDiscard pending promises that are waiting to run.\n\nThis might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.\n\nNote: This does not cancel promises that are already running.\n\n## FAQ\n\n### How is this different from the [`p-queue`](https://github.com/sindresorhus/p-queue) package?\n\nThis package is only about limiting the number of concurrent executions, while `p-queue` is a fully featured queue implementation with lots of different options, introspection, and ability to pause the queue.\n\n## Related\n\n- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control\n- [p-throttle](https://github.com/sindresorhus/p-throttle) - Throttle promise-returning & async functions\n- [p-debounce](https://github.com/sindresorhus/p-debounce) - Debounce promise-returning & async functions\n- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-p-limit?utm_source=npm-p-limit&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","homepage":"https://github.com/sindresorhus/p-limit#readme","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-limit.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"bugs":{"url":"https://github.com/sindresorhus/p-limit/issues"},"license":"MIT","readmeFilename":"readme.md"}
|