Registry / database / atomic-queue

atomic-queue

JSON →
library5.0.4jsnpmunverified

A crash-friendly queue for Node.js that persists queue state to disk and can safely restart after a crash. Uses a worker pool with configurable concurrency. Version 5.0.4 is the latest stable release; maintenance is infrequent. Key differentiators: zero external dependencies beyond core Node modules (LevelDB fork removed after v4), simple stream-based API, and automatic persistence of queue state. Compared to alternatives like Bull or Kue, it is minimal, with no Redis dependency. Primarily used in server-side applications requiring durable job processing without a dedicated message broker.

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

The package exports a single function via default export. Use default import for ESM.

import queue from 'atomic-queue'

CommonJS users must call require() directly; there is no named export.

const queue = require('atomic-queue')

There is no named export 'Queue'. Use default import to get the constructor function.

import queue from 'atomic-queue'

Shows how to create a queue with a worker function, write jobs, handle events, and end the queue.

import queue from 'atomic-queue'; import { createWriteStream } from 'fs'; const work = (data, done) => { console.log('Processing:', data); done(null); }; const q = queue(work, { concurrency: 5 }); q.on('ready', () => { console.log('Queue ready'); q.write('job1'); q.write('job2'); q.end(); }); q.on('error', (err) => { console.error('Queue error:', err); }); q.on('finish', () => { console.log('All jobs done'); });
Debug
Known footguns
breakingDropped built-in LevelDB persistence in v5. State persistence uses a simple JSON file by default, not LevelDB.
breakingAPI changed from constructor to factory function. You must call queue() directly, not with 'new'.
gotchaWorker function must call done() exactly once per job. Not calling done() causes the queue to hang.
deprecatedThe 'pool' events (start/finish) are deprecated and may be removed in a future major version.
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
15 hits · last 30 days
gptbot
3
amazonbot
3
bytedance
1
Resources