Registry / storage / data-queue

data-queue

JSON →
library0.0.3jsnpmunverified

A lightweight async data queue for Node.js that supports appending, prepending, and error handling. Version 0.0.3 is the latest stable release. It provides a simple callback-based API for buffering data and processing it asynchronously, similar to a stream but without the complexity. Key differentiators: minimal dependencies, no external libraries, and built-in error propagation that prevents further data addition after an error.

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

This package is CommonJS only; there is no ESM export.

const Queue = require('data-queue')

Queue() must be called without new; it is a factory function.

const queue = Queue()

append does not accept a callback; data is passed to the next get().

queue.append(data)

Shows basic usage: creating a queue, adding data, retrieving data with callbacks, and error handling.

const Queue = require('data-queue') const queue = Queue() // Consumer queue.get((err, data) => { if (err) { console.error(err); return } console.log('Received:', data) }) // Producer queue.append('Hello') queue.append('World') // Check size console.log('Queue height:', queue.height()) // Error propagation queue.error(new Error('Fatal')) // Subsequent appends are ignored queue.append('This will not be added')
Debug
Known footguns
gotchaCalling Queue() without new is required. Using new Queue() will throw because the function is not a constructor.
gotchaAfter queue.error() is called, all subsequent append/prepend calls are silently ignored. Data may be lost if you expect them to queue.
gotchaThe get() callback pattern is non-standard: the first argument is error, second is data. It's similar to Node.js callbacks but not identical in error handling behavior.
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
14 hits · last 30 days
gptbot
3
amazonbot
3
ahrefsbot
1
Resources