Registry / storage / seq-queue

seq-queue

JSON →
library0.0.5jsnpmunverified

seq-queue is a FIFO task queue for Node.js that serializes asynchronous operations, ensuring tasks execute in order. Version 0.0.5 is the latest stable release; the package is in maintenance mode with no recent updates. It provides timeout handling per task and events for timeout, close, and drain. Compared to async.queue or bottleneck, seq-queue is minimal with no external dependencies and focuses solely on ordered execution with timeout support.

npm install seq-queue
INSTALL
IMPORT
SIG · SEQ-QUEUE
S
seq-queue
storagejavascriptv0.0.5
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.

createQueue
import { createQueue } from 'seq-queue'
const seqqueue = require('seq-queue'); const queue = seqqueue.createQueue(1000);
CommonJS require works but ESM import is supported since the package ships both CJS and ESM.
default
import seqqueue from 'seq-queue'
const seqqueue = require('seq-queue').default
Default import works in ESM; CommonJS require returns the module object directly.
SeqQueue
import { SeqQueue } from 'seq-queue'
const SeqQueue = require('seq-queue').SeqQueue
TypeScript users may need the type; the package does not export types.

Creates a queue with 2-second timeout, pushes two tasks that execute sequentially, and listens for timeout events.

import { createQueue } from 'seq-queue'; const queue = createQueue(2000); queue.push(function(task) { setTimeout(() => { console.log('Task 1 done'); task.done(); }, 1000); }); queue.push(function(task) { setTimeout(() => { console.log('Task 2 done'); task.done(); }, 500); }); queue.on('timeout', (task) => { console.log('Task timed out'); });
Debug
Known issues
gotchaIf task.done() is never called, the queue will block indefinitely unless a timeout is set.
fix
Always call task.done() in the task callback, or set a timeout on the queue or individual tasks.
affects: >=0.0.1
gotchaCalling task.done() after a timeout is ignored; the queue moves on to the next task.
fix
Do not call task.done() after the task has timed out; handle cleanup in the task function.
affects: >=0.0.1
gotchaQueue does not support concurrency; tasks are strictly sequential.
fix
Use a library like async.queue or bottleneck for concurrent task processing.
affects: >=0.0.1
gotchaNo built-in error handling for task exceptions; uncaught errors may crash the process.
fix
Wrap task content in try-catch and call task.done() in the finally block or use a domain.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: queue.push is not a function
CommonJS require() returns the module directly, not a constructor. Using require('seq-queue').createQueue is correct.
fix
Use const queue = require('seq-queue').createQueue(1000);
Error: task.done is not a function
The task argument passed to the callback is not a proper object, possibly due to incorrect import.
fix
Ensure you are using the latest version and importing correctly. Check that the function signature is (task) => { ... }.
ReferenceError: task is not defined
Using task variable outside of the push callback.
fix
Define task as a parameter of the callback function passed to queue.push().
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
24 hits · last 30 days
node
22
Resources
seq-queue — npm install seq-queue · libregistry