Registry / testing / simple-in-memory-queue

simple-in-memory-queue

JSON →
library1.1.7jsnpmunverified

Simple-in-memory-queue v1.1.7 is a lightweight in-memory queue library for Node.js (>=8) and browser environments, written in TypeScript with included type definitions. It provides basic queue operations (push, pop, peek) and event subscriptions, along with built-in consumer patterns: debounce, batch, and resilient remote consumer with retries and backpressure. Unlike heavier alternatives like Bull or Bee-Queue, it requires no external storage or message broker, making it ideal for simple client-side or server-side queuing needs. The library is actively maintained with frequent releases.

npm install simple-in-memory-queue
INSTALL
IMPORT
SIG · SIMPLE-IN-MEMORY-Q
S
simple-in-memory-queue
testingjavascriptv1.1.7
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 'simple-in-memory-queue'
ESM import with named export. Requires TypeScript or Node.js ESM.

Shows basic queue creation with FIFO order, push/pop/peek operations, and event subscription.

import { createQueue, QueueOrder } from 'simple-in-memory-queue'; const queue = createQueue({ order: QueueOrder.FIRST_IN_FIRST_OUT }); queue.push('a'); queue.push(['b', 'c']); console.log(queue.peek()); // ['a'] console.log(queue.pop(2)); // ['a', 'b'] console.log(queue.length); // 1 queue.on.push.subscribe(({ item }) => console.log('pushed:', item)); queue.push('d'); // logs 'pushed: d'
Debug
Known issues
gotchaCalling pop() with no arguments returns an array of one item, not a single value.
fix
Use pop(1) for an array of one item, or destructure: const [item] = queue.pop();
affects: >=0.0.0
gotchaThe `order` option is required in createQueue object argument even if order doesn't matter.
fix
Pass { order: QueueOrder.FIRST_IN_FIRST_OUT } explicitly.
affects: >=0.0.0
gotchapush accepts a single item or an array of items. Passing an array as a single item will be treated as multiple items.
fix
To push an array as a single item, wrap it: queue.push([myArray]);
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: queue.pop is not a function
Importing incorrectly, e.g., import Queue from 'simple-in-memory-queue' instead of named import.
fix
Use correct import: import { createQueue } from 'simple-in-memory-queue';
Cannot read property 'subscribe' of undefined
Trying to subscribe to events before creating the queue.
fix
Create the queue first: const queue = createQueue(...); then queue.on.push.subscribe(...);
Upgrade
Version history
1.1.7latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
simple-in-memory-queue — npm install simple-in-memory-queue · libregistry