{"id":16590882,"url":"https://github.com/magic-akari/p_limit","last_synced_at":"2026-04-19T17:33:19.858Z","repository":{"id":62422074,"uuid":"363902029","full_name":"magic-akari/p_limit","owner":"magic-akari","description":"Run multiple promise-returning \u0026 async functions with limited concurrency. For Deno.","archived":false,"fork":false,"pushed_at":"2023-10-02T09:34:54.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-17T19:21:22.642Z","etag":null,"topics":["deno"],"latest_commit_sha":null,"homepage":"https://deno.land/x/p_limit","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magic-akari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-05-03T11:06:43.000Z","updated_at":"2023-10-02T09:34:48.000Z","dependencies_parsed_at":"2022-11-01T17:33:01.720Z","dependency_job_id":null,"html_url":"https://github.com/magic-akari/p_limit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic-akari%2Fp_limit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic-akari%2Fp_limit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic-akari%2Fp_limit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magic-akari%2Fp_limit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magic-akari","download_url":"https://codeload.github.com/magic-akari/p_limit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242213392,"owners_count":20090694,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deno"],"created_at":"2024-10-11T23:14:38.404Z","updated_at":"2026-04-19T17:33:19.792Z","avatar_url":"https://github.com/magic-akari.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# p_limit\n\nsimilar to [p-limit](https://www.npmjs.com/package/p-limit) but for Deno.\n\n\u003e Run multiple promise-returning \u0026 async functions with limited concurrency\n\n## Usage\n\n```js\nimport { pLimit } from \"https://deno.land/x/p_limit@v1.0.0/mod.ts\";\n\nconst limit = pLimit(1);\n\nconst input = [\n  limit(() =\u003e fetchSomething(\"foo\")),\n  limit(() =\u003e fetchSomething(\"bar\")),\n  limit(() =\u003e doSomething()),\n];\n\n(async () =\u003e {\n  // Only one promise is run at once\n  const result = await Promise.all(input);\n  console.log(result);\n})();\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\navoid creating unnecessary closures. You probably don't need this optimization\nunless 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\ncalled 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\nprogram's lifecycle or discard any function calls referencing an intermediary\nstate of your app.\n\nNote: This does not cancel promises that are already running.\n\n## Acknowledgements\n\n[p-limit](https://www.npmjs.com/package/p-limit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagic-akari%2Fp_limit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagic-akari%2Fp_limit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagic-akari%2Fp_limit/lists"}