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.

devops
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.

Package is ESM-only since v2. Using require() will throw.

import SimpleQueue from 'SimpleQueue'

Default export is not named; avoid confusion with named export.

import { SimpleQueue } from 'SimpleQueue'

Dynamic import must destructure the named export.

const { SimpleQueue } = await import('SimpleQueue')

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 footguns
breakingIn v2.0.0, the package switched to ESM-only. Code using require('SimpleQueue') will fail with ERR_REQUIRE_ESM.
breakingIn v2.0.0, the constructor's concurrent parameter default was changed from 10 to 20.
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.
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.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
26 hits · last 30 days
bytedance
4
gptbot
3
amazonbot
3
mj12bot
2
dotbot
1
ahrefsbot
1
Resources