Registry / testing / it-queue

it-queue

JSON →
library1.1.3jsnpmunverified

it-queue (v1.1.3) is an async queue implementation built on top of p-queue, providing the ability to iterate over queue results using async generators. It ships TypeScript types and follows the 'it' family of packages focused on async iteration patterns. Key differentiators: aborting a task removes it from the queue, and results can be consumed via `for await...of` or `it-all`. Compared to p-queue, it-queue gives direct access to the underlying queue and supports iteration over completed items. The package is part of the libp2p/achingbrain ecosystem and is actively maintained.

testing
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Named export only; no default export.

import { Queue } from 'it-queue'

Must destructure because Queue is a named export.

const { Queue } = require('it-queue')

Use type-only import for improved compile-time performance.

import type { Queue } from 'it-queue'

Creates a queue with concurrency 2, adds three async tasks, and iterates over results using it-all.

import { Queue } from 'it-queue' import all from 'it-all' const queue = new Queue({ concurrency: 2 }) queue.add(async () => { await new Promise(resolve => setTimeout(resolve, 100)) return 'first' }) queue.add(async () => { return 'second' }) queue.add(async () => { return 'third' }) // Wait for all results const results = await all(queue) console.log(results) // ['first', 'second', 'third'] console.log(queue.size) // 0 (all completed) console.log(queue.running) // 0 console.log(queue.queued) // 0
Debug
Known footguns
gotchaThe queue must be consumed via iteration (e.g., `for await...of` or `it-all`) to drain tasks; otherwise, they will never run.
gotchaAborting a task removes it from the queue, but the abort signal must be passed in the task options.
deprecatedThe `queue.abort()` method is deprecated since v1.1.0 in favor of per-task abort signals.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
11 hits · last 30 days
gptbot
3
amazonbot
2
ahrefsbot
1
Resources