All tiny-* async utilities in one package. Drop-in replacements for p-limit, p-map, p-retry, and p-queue that ship ESM + CJS.
import { pLimit, pMap, pRetry, PQueue } from "tiny-pasync";One install. Four utilities. All dual-format, all typed, all zero-dep individually.
npm install tiny-pasync| Export | Replaces | Docs |
|---|---|---|
pLimit |
p-limit | tiny-limit |
pMap, pMapSkip |
p-map | tiny-map |
pRetry, AbortError |
p-retry | tiny-retry |
PQueue |
p-queue | tiny-queue |
Each utility is also available as a standalone package if you only need one.
import { pLimit } from "tiny-pasync";
const limit = pLimit(5);
const results = await Promise.all(urls.map((url) => limit(() => fetch(url))));import { pMap } from "tiny-pasync";
const pages = await pMap(urls, (url) => fetch(url).then((r) => r.text()), {
concurrency: 10,
});import { pRetry } from "tiny-pasync";
const data = await pRetry(() => fetchFromUnreliableAPI(), { retries: 3 });import { PQueue } from "tiny-pasync";
const queue = new PQueue({ concurrency: 2 });
await queue.add(() => processJob(1));
await queue.add(() => urgentJob(), { priority: 10 });
await queue.onIdle();p-limit v4+, p-map v6+, p-retry v6+, and p-queue v8+ are all ESM-only. CommonJS projects that require() them get ERR_REQUIRE_ESM.
The tiny-* packages ship both ESM and CJS, include TypeScript types, and have zero dependencies. This meta-package re-exports everything from one import.
| Package | Replaces | What it does |
|---|---|---|
| tiny-limit | p-limit | Concurrency limiter |
| tiny-map | p-map | Concurrent map with order |
| tiny-retry | p-retry | Retry with exponential backoff |
| tiny-queue | p-queue | Priority task queue |
| tiny-ms | ms | Parse/format durations |
| tiny-escape | escape-string-regexp | Escape regex chars |
| tiny-pasync | all of the above | One import for all async utils |
If this saved you from ERR_REQUIRE_ESM, star the repo or open an issue if something breaks.
README built with README Builder