https://github.com/ofershap/tiny-async
All tiny-* async utilities in one package. Drop-in replacements for p-limit, p-map, p-retry, p-queue.
https://github.com/ofershap/tiny-async
Last synced: 3 months ago
JSON representation
All tiny-* async utilities in one package. Drop-in replacements for p-limit, p-map, p-retry, p-queue.
- Host: GitHub
- URL: https://github.com/ofershap/tiny-async
- Owner: ofershap
- License: mit
- Created: 2026-03-05T19:21:53.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-03-05T21:45:12.000Z (3 months ago)
- Last Synced: 2026-03-05T22:39:20.676Z (3 months ago)
- Language: TypeScript
- Size: 260 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# tiny-async
[](https://www.npmjs.com/package/tiny-pasync)
[](https://www.npmjs.com/package/tiny-pasync)
[](https://github.com/ofershap/tiny-async/actions/workflows/ci.yml)
[](https://www.typescriptlang.org/)
[](https://opensource.org/licenses/MIT)
All tiny-\* async utilities in one package. Drop-in replacements for `p-limit`, `p-map`, `p-retry`, and `p-queue` that ship ESM + CJS.
```ts
import { pLimit, pMap, pRetry, PQueue } from "tiny-pasync";
```
> One install. Four utilities. All dual-format, all typed, all zero-dep individually.
## Install
```bash
npm install tiny-pasync
```
## What's included
| Export | Replaces | Docs |
| ---------------------- | -------- | ---------------------------------------------------- |
| `pLimit` | p-limit | [tiny-limit](https://github.com/ofershap/tiny-limit) |
| `pMap`, `pMapSkip` | p-map | [tiny-map](https://github.com/ofershap/tiny-map) |
| `pRetry`, `AbortError` | p-retry | [tiny-retry](https://github.com/ofershap/tiny-retry) |
| `PQueue` | p-queue | [tiny-queue](https://github.com/ofershap/tiny-queue) |
Each utility is also available as a standalone package if you only need one.
## Quick examples
### Limit concurrency
```ts
import { pLimit } from "tiny-pasync";
const limit = pLimit(5);
const results = await Promise.all(urls.map((url) => limit(() => fetch(url))));
```
### Map with concurrency
```ts
import { pMap } from "tiny-pasync";
const pages = await pMap(urls, (url) => fetch(url).then((r) => r.text()), {
concurrency: 10,
});
```
### Retry with backoff
```ts
import { pRetry } from "tiny-pasync";
const data = await pRetry(() => fetchFromUnreliableAPI(), { retries: 3 });
```
### Task queue with priority
```ts
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();
```
## Why not just install the originals?
`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.
## The tiny-\* family
| Package | Replaces | What it does |
| ------------------------------------------------------ | -------------------- | ------------------------------ |
| [tiny-limit](https://github.com/ofershap/tiny-limit) | p-limit | Concurrency limiter |
| [tiny-map](https://github.com/ofershap/tiny-map) | p-map | Concurrent map with order |
| [tiny-retry](https://github.com/ofershap/tiny-retry) | p-retry | Retry with exponential backoff |
| [tiny-queue](https://github.com/ofershap/tiny-queue) | p-queue | Priority task queue |
| [tiny-ms](https://github.com/ofershap/tiny-ms) | ms | Parse/format durations |
| [tiny-escape](https://github.com/ofershap/tiny-escape) | escape-string-regexp | Escape regex chars |
| **tiny-pasync** | all of the above | One import for all async utils |
## Author
[](https://gitshow.dev/ofershap)
[](https://linkedin.com/in/ofershap)
[](https://github.com/ofershap)
---
If this saved you from `ERR_REQUIRE_ESM`, [star the repo](https://github.com/ofershap/tiny-async) or [open an issue](https://github.com/ofershap/tiny-async/issues) if something breaks.
---
README built with [README Builder](https://ofershap.github.io/readme-builder/)
## License
[MIT](LICENSE) © [Ofer Shapira](https://github.com/ofershap)