Registry / devops / queuefy

queuefy

JSON →
library1.2.1jsnpmunverified

queuefy v1.2.1 is a lightweight TypeScript library wrapping async functions to execute them sequentially in a first-in-first-out queue, ensuring single-thread-like order without backpressure or concurrency control. It is maintained by QIWI and published on npm with a weekly release cadence. Differentiators: zero dependencies, tiny API (single `queuefy` function), and native TypeScript support. Unlike alternatives like p-queue, it offers no concurrency limit or priority — purely FIFO serialization.

npm install queuefy
INSTALL
IMPORT
SIG · QUEUEFY
Q
queuefy
devopsjavascriptv1.2.1
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.

queuefy
import { queuefy } from 'queuefy'
const queuefy = require('queuefy')
ESM-only package; named export, not default.

Wraps an async function with a queue so simultaneous calls run sequentially, each waiting for the previous to resolve.

import { queuefy } from 'queuefy'; let count = 0; const target = (param: number) => new Promise<number>(resolve => setTimeout(() => { count++; resolve(count + param); }, Math.random() * 100), ); const fn = queuefy(target); const results = await Promise.all([fn(4), fn(3), fn(2), fn(1), fn(0)]); console.log(results); // [5, 5, 5, 5, 5]
Debug
Known issues
gotchaqueuefy does not limit concurrency; all calls queue up without backpressure, which can cause unbounded memory growth.
fix
Use a library like p-queue if you need concurrency control, or implement your own buffer limit.
affects: >=1.0.0
gotchaThe wrapped function returns a Promise that resolves in FIFO order, but each call's value depends on shared mutable state (count in example) — not a bug, but easily misused.
fix
Ensure the wrapped function does not rely on external state that might change between queued calls, or use closures to capture state per call.
affects: >=1.0.0
deprecatedqueuefy has no built-in error handling; if the function throws, the queue stops processing subsequent calls unless you catch the error.
fix
Wrap the function body in try/catch to prevent unhandled rejections from blocking the queue.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: queuefy is not a function
Using default import instead of named import.
fix
Use import { queuefy } from 'queuefy' instead of import queuefy from 'queuefy'.
Cannot find module 'queuefy' or its corresponding type declarations.
Missing npm install or using require() in a Node.js CJS environment.
fix
Run npm install queuefy; ensure tsconfig 'moduleResolution' is 'node' and 'esModuleInterop' is true.
UnhandledPromiseRejectionWarning: Error [ERR_UNHANDLED_REJECTION] - the queue stopped processing
Wrapped function threw an error that was not caught.
fix
Add try/catch inside the wrapped function's implementation.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
queuefy — npm install queuefy · libregistry