Registry / devops / SimpleQueue

SimpleQueue

JSON →
library2.0.0jsnpmunverified

A simple, typed FIFO queue for Node.js that guarantees in-order delivery of processed items. Version 2.0.0 is the current stable release with a maintenance cadence. Unlike many FIFO queues that destroy order during parallel processing, SimpleQueue preserves original element order when using callbacks. Ships TypeScript definitions. Requires Node.js >=20.19.0.

npm install SimpleQueue
INSTALL
IMPORT
SIG · SIMPLEQUEUE
S
SimpleQueue
devopsjavascriptv2.0.0
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.

SimpleQueue
import SimpleQueue from 'SimpleQueue'
const SimpleQueue = require('SimpleQueue')
Package is ESM-only since v2. Using require() will throw.
SimpleQueue
import { SimpleQueue } from 'SimpleQueue'
import SimpleQueue from 'SimpleQueue'
Default export is not named; avoid confusion with named export.
SimpleQueue
const { SimpleQueue } = await import('SimpleQueue')
const SimpleQueue = await import('SimpleQueue')
Dynamic import must destructure the named export.

Creates a SimpleQueue to process items in FIFO order, logging 'Processed X' for each element and 'All done' when queue empties.

import SimpleQueue from 'SimpleQueue'; const queue = new SimpleQueue( (element: number, callback: (err: Error | null, result: string) => void) => { setTimeout(() => callback(null, `Processed ${element}`), element); }, (err, result, element) => { console.log(result); }, () => { console.log('All done'); }, 3, // concurrency ); queue.push(100); queue.push(50); queue.push(200);
Debug
Known issues
breakingIn v2.0.0, the package switched to ESM-only. Code using require('SimpleQueue') will fail with ERR_REQUIRE_ESM.
fix
Use import SimpleQueue from 'SimpleQueue' or dynamic import.
affects: >=2.0.0
breakingIn v2.0.0, the constructor's concurrent parameter default was changed from 10 to 20.
fix
If you relied on the old default of 10, explicitly pass 10 as the concurrent argument.
affects: >=2.0.0
gotchaThe worker callback (error, result) expects the first argument to be an Error | null. Passing a non-null error will cause the queue to abort and call the done callback immediately.
fix
Always call callback(null, result) on success, and callback(error, undefined) on failure.
affects: >=1.0.0
gotchaThe done callback is called only once when the queue becomes empty. If the queue is aborted or never started, done may not be called.
fix
Use the pause/resume and abort properly to manage termination.
affects: >=1.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module not supported
Using require() on an ESM-only package (v2+).
fix
Change to import SimpleQueue from 'SimpleQueue'
TypeError: SimpleQueue is not a constructor
Importing a named export as default when default is also available.
fix
Use import SimpleQueue from 'SimpleQueue' (default export) instead of import { SimpleQueue } from 'SimpleQueue'
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
64 hits · last 30 days
node
56
OpenAI (training)
1
Resources
SimpleQueue — npm install SimpleQueue · libregistry