1. License
“to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”
MIT allows use in paid and closed-source apps.
github.com/sindresorhus/p-limit/blob/main/license3. Used by agents' projects
Dependency in 29 public GitHub projects set up for AI coding agents that we scanned (0.5%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What p-limit does
p-limit is a tiny free JavaScript library that caps how many slow jobs run at the same time, such as downloads, file reads or calls to an AI service. Other jobs wait in line and start as soon as a slot frees up. Your app stays fast without flooding a server or hitting its limits.
What people build with it
Fetch many pages, three at a time
Your script loads a list of pages or records from a service; it keeps only a few requests open so the service does not block you.
Process a folder of uploads
A batch job reads hundreds of uploaded files; five at a time keeps memory and disk use steady.
Slow down when a service says wait
When an AI or data service answers "too many requests", lower the number of parallel calls on the fly, then raise it again.
Keep going when some calls fail
One broken link should not stop a run of a thousand; collect the good results and list the failures at the end.
Show progress of a long run
Print how many jobs are running and how many still wait, so people know a long import is moving.
Batch AI calls for a spreadsheet Idea
Your assistant writes a script that summarizes 500 rows with an AI service, four requests at a time, to stay within the plan's limits.
p-limit popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How p-limit is used
- p-limit is a dependency in 29 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.6% of the 4,867 JavaScript/TypeScript ones), #49 of 408 in utilities.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 131; those are left out of every share on this page.
- Projects that use it most often also use Vitest (82.8%), tsx (69.0%), dotenv (62.1%).
By coding agent
Often used with
More about p-limit
Funding
- GitHub Sponsors: https://github.com/sindresorhus
- Open Collective: https://opencollective.com/sindresorhus
- Buy Me a Coffee: https://buymeacoffee.com/sindresorhus
- Own page: https://sindresorhus.com/donate
- 186 GitHub sponsors
Alternatives
p-limit This page
Pick p-queue when you need a full queue you can pause, inspect and tune with more options.
Pick p-map when you map one list of inputs through one async function and want more options for that case.
Pick p-throttle when the service limits calls per time window rather than calls running at once.
Get started
Tell your AI assistant
“Use p-limit 7.3.3 (ES module, Node.js 20+) to run these requests with at most 3 at a time via limit.map, use Promise.allSettled so one failure does not stop the run, and never call the same limit inside a limited job.”
Add the package (it needs Node.js 20 or newer, or any modern browser via a bundler).
npm install p-limitMake a limiter with the number of jobs allowed at once, and wrap each job in it.
import pLimit from 'p-limit'; const limit = pLimit(1); const input = [ limit(() => fetchSomething('foo')), limit(() => fetchSomething('bar')), limit(() => doSomething()) ]; // Only one promise is run at once const result = await Promise.all(input); console.log(result);
Mistakes to avoid
The package has been ES module only since version 4.
The outer jobs hold every slot while they wait for inner jobs that can never start.
Without that option the cleared jobs' promises never settle, so the await hangs.
p-limit counts jobs running at the same moment; fast jobs can still exceed a per-minute cap.
Version 7 raised the minimum to Node.js 20.
Questions
How is it different from p-queue?
p-limit only caps how many jobs run at once. p-queue is a full queue with more options, inspection and pausing.
Can I change the limit while it runs?
Yes. Set limit.concurrency to a new number; the recipes lower it when a service answers 429 and raise it again later.
Does it work in the browser?
Yes, the readme says it works in Node.js and browsers.
Are results returned in the order I passed the jobs?
Yes. limit.map works like Promise.all over the inputs, so results keep the input order even when jobs finish in a different order.
Is it still maintained?
Yes. Version 7.3.3 came out on 2026-09-18 with a fix for limit.map.