# plimit-lit

> This package is a helper to run multiple promise-returning & async functions with limited concurrency.

Latest version **3.4.0** (published 2026-06-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install plimit-lit
pnpm add plimit-lit
yarn add plimit-lit
bun add plimit-lit
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 3.4.0 |
| Published | 2026-06-28 |
| First published | 2021-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 1 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Joel Voss |
| Maintainers | joelvoss |

## Links

- npm: https://www.npmjs.com/package/plimit-lit
- Repository: https://github.com/joelvoss/plimit-lit
- Issues: https://github.com/joelvoss/plimit-lit/issues
- npm.io page: https://npm.io/package/plimit-lit

## Dependencies (1)

- [queue-lit](https://npm.io/package/queue-lit.md) 3.3.0

## Recent versions

- 3.4.0 (latest) — 2026-06-28
- 3.3.0 — 2026-05-09
- 3.2.1 — 2026-04-07
- 3.2.0 — 2026-04-07
- 3.1.0 — 2026-03-23
- 3.0.1 — 2024-05-20
- 3.0.0 — 2024-05-19
- 2.1.0 — 2023-10-12
- 2.0.0 — 2023-10-05
- 1.6.1 — 2023-10-05
- 1.6.0 — 2023-10-03
- 1.5.0 — 2022-11-10
- 1.4.1 — 2022-10-16
- 1.4.0 — 2022-09-05
- 1.3.0 — 2022-07-24
- … 15 more at https://npm.io/package/plimit-lit/versions

## README

# plimit-lit

This package is a helper to run multiple promise-returning & async functions
with limited concurrency.

## Installation

```bash
$ npm i plimit-lit
# or
$ yarn add plimit-lit
```

## Usage

```js
import { pLimit } from 'plimit-lit';

const limit = pLimit(1);

(async () => {
	// NOTE: Only one promise is run at once
	const result = await Promise.all([
		limit(() => fetchSomething('foo')),
		limit(() => fetchSomething('bar')),
		limit(() => doSomething()),
	]);
	console.log(result);
})();
```

## API

### `limit = pLimit(concurrency)`

Returns a `limit` function to enqueue promise returning or async functions.

#### `concurrency`

Type: `number`

Number of the concurrency limit.

### `limit(fn, ...args)`

Returns a promise returned from calling `fn(...args)`.

#### `fn`

Type: `Function`

Promise-returning or async function.

#### `args`

Optional arguments `fn` is being called with.

> **Note:** Support 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.

### `limit.activeCount`

Static method that returns the number of promises currently running.

### `limit.pendingCount`

Static method that returns the number of promises currently waiting to be run
(i.e. their internal `fn` was not called yet).

### `limit.clearQueue()`

Clear the internal queue of promises. This discards pending promises that are
waiting to be run.

> **Note:** This does not cancel in-flight promises!

## Development

(1) Install dependencies

```bash
$ npm i
# or
$ yarn
```

(2) Run initial validation

```bash
$ ./Taskfile.sh validate
```

(3) Start developing. See [`./Taskfile.sh`](./Taskfile.sh) for more tasks to
help you develop.

---
_Source: https://npm.io/package/plimit-lit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
