{"id":45170,"library":"it-queue","title":"it-queue: Async Queue with Iteration","description":"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.","status":"active","version":"1.1.3","language":"javascript","source_language":"en","source_url":"https://github.com/achingbrain/it","tags":["javascript","typescript"],"install":[{"cmd":"npm install it-queue","lang":"bash","label":"npm"},{"cmd":"yarn add it-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add it-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Named export only; no default export.","wrong":"import Queue from 'it-queue'","symbol":"Queue","correct":"import { Queue } from 'it-queue'"},{"note":"Must destructure because Queue is a named export.","wrong":"const Queue = require('it-queue')","symbol":"Queue (CommonJS)","correct":"const { Queue } = require('it-queue')"},{"note":"Use type-only import for improved compile-time performance.","symbol":"Queue type (TypeScript)","correct":"import type { Queue } from 'it-queue'"}],"quickstart":{"code":"import { Queue } from 'it-queue'\nimport all from 'it-all'\n\nconst queue = new Queue({ concurrency: 2 })\n\nqueue.add(async () => {\n  await new Promise(resolve => setTimeout(resolve, 100))\n  return 'first'\n})\nqueue.add(async () => {\n  return 'second'\n})\nqueue.add(async () => {\n  return 'third'\n})\n\n// Wait for all results\nconst results = await all(queue)\nconsole.log(results) // ['first', 'second', 'third']\nconsole.log(queue.size) // 0 (all completed)\nconsole.log(queue.running) // 0\nconsole.log(queue.queued) // 0","lang":"typescript","description":"Creates a queue with concurrency 2, adds three async tasks, and iterates over results using it-all."},"warnings":[{"fix":"Always iterate over the queue instance to process tasks. If you don't need the results, consider using a different queue library.","message":"The queue must be consumed via iteration (e.g., `for await...of` or `it-all`) to drain tasks; otherwise, they will never run.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass `signal` as part of the second argument to `add()`: `queue.add(task, { signal })`.","message":"Aborting a task removes it from the queue, but the abort signal must be passed in the task options.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use `AbortController` and pass `signal` to individual tasks instead of calling `queue.abort()`.","message":"The `queue.abort()` method is deprecated since v1.1.0 in favor of per-task abort signals.","severity":"deprecated","affected_versions":">=1.1.0"}],"env_vars":null,"search_vec":"'abil':26 'abort':53 'access':84 'activ':105 'async':4,14,33,48 'await':68 'built':17 'compar':74 'complet':93 'consum':65 'differenti':52 'direct':83 'ecosystem':102 'famili':43 'focus':46 'follow':40 'generat':34 'give':82 'implement':16 'it-al':71 'it-queu':1,8,79 'item':94 'iter':7,28,49,91 'javascript':107 'key':51 'libp2p/achingbrain':101 'maintain':106 'p':22,77 'p-queue':21,76 'packag':45,96 'part':98 'pattern':50 'provid':24 'queue':3,5,10,15,23,30,60,78,81,88 'remov':56 'result':31,62 'ship':36 'support':90 'task':55 'top':19 'type':38 'typescript':37,108 'under':87 'use':32 'v1.1.3':11 'via':66","created_at":"2026-06-07T12:53:42.458449+00:00","updated_at":"2026-06-07T12:53:42.458449+00:00","problems":[{"fix":"Use `for await (const result of queue)` or `await all(queue)`.","cause":"Using `for (const result of queue)` without async iteration (the queue is an async iterable).","error":"TypeError: queue is not iterable"},{"fix":"Start iterating over the queue (e.g., `for await...of queue`) immediately after adding tasks.","cause":"Forgetting to consume the queue; no tasks will start processing until you iterate.","error":"Cannot read properties of undefined (reading 'Symbol(asyncIterator)')"},{"fix":"Handle the abort error in your task or catch it when iterating.","cause":"A task was aborted via its signal, which is expected behavior but may be confusing.","error":"Error: The task was aborted"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/achingbrain/it/tree/main/packages/it-queue#readme","github":"https://github.com/achingbrain/it","docs":null,"changelog":null,"pypi":null,"npm":"it-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}