# aceink

> Async tools

Latest version **2.1.0** (published 2026-03-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install aceink
pnpm add aceink
yarn add aceink
bun add aceink
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2026-03-16 |
| First published | 2023-04-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 267.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 7 |
| Author | Caleb Boyd |
| Maintainers | calebboyd |

## Links

- npm: https://www.npmjs.com/package/aceink
- Repository: https://github.com/calebboyd/aceink
- Homepage: https://github.com/calebboyd/aceink#readme
- Issues: https://github.com/calebboyd/aceink/issues
- npm.io page: https://npm.io/package/aceink

## Recent versions

- 2.1.0 (latest) — 2026-03-16
- 2.0.0 — 2026-03-16
- 1.3.1 — 2026-03-16
- 1.3.0 — 2023-09-13
- 1.2.0 — 2023-09-12
- 1.1.0 — 2023-09-11
- 1.0.1 — 2023-04-01
- 3.0.1 — 2023-04-01
- 1.0.0 — 2023-04-01

## README

## aceink

Useful async tools.

- `createLock`
  - a simple counting sempahore
- `createDeferred`
  - simple deferred promise
- `q`
  - a concurrent work queue
  - supports `pause()`, `start()`, `clear()`, and `onEmpty()` for queue control
- `each`, `map`
  - _optionally_ concurrent iteration functions
- `timeout` and `signal` options
  - bound hung queue, each, and map work
- `gowait`
  - convert a promise or promise returning function to `[error,result]` tuples
- `delay`
  - delay ms, optionally resolve an argument
- `noop`, `identity`, `once`
  - Other useful language functions

Get it on npm: `npm install aceink`

See the generated documentation [here](/docs/globals.md)

---

### Example (queue)

```javascript
import { q } from 'aceink'

const { ready, add, empty } = q(10)

function fetchQux(bar) {
  return fetch(`https://example.com/${bar}`)
}

for (const foo of Array(100).keys()) {
  await ready()
  add(fetchQux, foo)
}
return empty()
```

Queue tasks can also be time-bounded or aborted while waiting or running:

```javascript
import { AbortError, q } from 'aceink'

const queue = q(2, { timeout: 5000 })
const controller = new AbortController()

try {
  const work = queue.add(() => fetch('https://example.com'), undefined, { signal: controller.signal })

  controller.abort()
  await work
} catch (error) {
  if (!(error instanceof AbortError)) throw error
}
```

Queues can also be paused, resumed, or cleared without affecting work that is already running:

```javascript
import { QueueClearedError, q } from 'aceink'

const queue = q(2)

queue.pause()
const work = queue.add(async () => 'value')

queue.start()
await work

const queued = queue.add(async () => 'queued later')
queue.clear()

try {
  await queued
} catch (error) {
  if (!(error instanceof QueueClearedError)) throw error
}

await queue.onEmpty() // queued work has been dequeued; running work may still settle
```

### Example (gowait)

```javascript
import { gowait, delay } from 'aceink'

const [err, value] = await gowait(delay(100, 42))
console.log(value) //42
```

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