Registry / devops / pico-queue

pico-queue

JSON →
library1.2.2jsnpmunverified

At only 156 bytes gzipped, pico-queue is a dead-simple, TypeScript-native asynchronous function queue for Node.js and browser. Version 1.2.2 is the current stable release, maintained at a low cadence. It serializes execution of async/sync functions, supports chaining results between tasks, and provides typed generics for safe chaining. Unlike heavier libraries like async/queue or p-limit, pico-queue is minimal but lacks concurrency control or priority.

npm install pico-queue
INSTALL
IMPORT
SIG · PICO-QUEUE
P
pico-queue
devopsjavascriptv1.2.2
harness data pending
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.

createAsyncQueue
import { createAsyncQueue } from 'pico-queue'
const createAsyncQueue = require('pico-queue')
ESM-only; TypeScript types included. No default export.
AsyncQueue
import type { AsyncQueue } from 'pico-queue'
import { AsyncQueue } from 'pico-queue'
Type import only. AsyncQueue is not a runtime export.
createAsyncQueue (CommonJS)
const { createAsyncQueue } = require('pico-queue')
const createAsyncQueue = require('pico-queue').default
CommonJS via require is supported in Node, but default import pattern does not exist.

Creates an async queue, pushes three tasks that run in order, then shows chaining and await.

import { createAsyncQueue } from 'pico-queue' const queue = createAsyncQueue() // Queue async functions sequentially queue.push(async () => { console.log('first') }) queue.push(async () => { await new Promise(r => setTimeout(r, 100)) console.log('second (after 100ms)') }) queue.push(() => { console.log('third') }) // Handle completion of the last task const result = await queue.push(async (prev) => { console.log('Got:', prev) return 'done' })
Debug
Known issues
gotchaIf a task rejects and the error is not caught, the queue stalls permanently.
fix
Always attach .catch() or use try/catch around await queue.push().
affects: >=1.0.0
gotchacreateAsyncQueue() without arguments returns a queue with initial chaining value undefined.
fix
Provide an initial value if the first task expects a defined argument.
affects: >=1.0.0
deprecatedVersion 1.x uses Travis CI (obsolete); build status badge may not reflect current health.
fix
Ignore Travis badge; rely on GitHub status.
affects: >=1.0.0
gotchaThe library does not support concurrency limits—all tasks are serial. For parallel with limit, use p-limit.
fix
Consider p-limit or async.queue if you need concurrency.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: createAsyncQueue is not a function
Default import used instead of named import.
fix
import { createAsyncQueue } from 'pico-queue'
Unhandled promise rejection: Error: queue.push on stalled queue
A previous task rejected without a .catch handler, halting the queue permanently.
fix
Always handle rejections: await queue.push(...).catch(e => {}) or use try/catch.
Upgrade
Version history
1.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
pico-queue — npm install pico-queue · libregistry