{"id":46373,"library":"simple-in-memory-queue","title":"simple-in-memory-queue","description":"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.","status":"active","version":"1.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/ehmpathy/simple-in-memory-queue","tags":["javascript","queue","memory","in-memory","browser","browser queue","nodejs","nodejs queue","simple","typescript"],"install":[{"cmd":"npm install simple-in-memory-queue","lang":"bash","label":"npm"},{"cmd":"yarn add simple-in-memory-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-in-memory-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM import with named export. Requires TypeScript or Node.js ESM.","symbol":"createQueue","correct":"import { createQueue } from 'simple-in-memory-queue'"}],"quickstart":{"code":"import { createQueue, QueueOrder } from 'simple-in-memory-queue';\n\nconst queue = createQueue({ order: QueueOrder.FIRST_IN_FIRST_OUT });\n\nqueue.push('a');\nqueue.push(['b', 'c']);\n\nconsole.log(queue.peek()); // ['a']\nconsole.log(queue.pop(2)); // ['a', 'b']\nconsole.log(queue.length); // 1\n\nqueue.on.push.subscribe(({ item }) => console.log('pushed:', item));\nqueue.push('d'); // logs 'pushed: d'","lang":"typescript","description":"Shows basic queue creation with FIFO order, push/pop/peek operations, and event subscription."},"warnings":[{"fix":"Use pop(1) for an array of one item, or destructure: const [item] = queue.pop();","message":"Calling pop() with no arguments returns an array of one item, not a single value.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass { order: QueueOrder.FIRST_IN_FIRST_OUT } explicitly.","message":"The `order` option is required in createQueue object argument even if order doesn't matter.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"To push an array as a single item, wrap it: queue.push([myArray]);","message":"push accepts a single item or an array of items. Passing an array as a single item will be treated as multiple items.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'8':22 'activ':95 'along':44 'altern':63 'backpressur':60 'basic':35 'batch':52 'bee':68 'bee-queu':67 'broker':77 'browser':24,106,107 'built':47 'built-in':46 'bull':65 'client':84 'client-sid':83 'consum':49,56 'debounc':51 'definit':32 'environ':25 'event':42 'extern':73 'frequent':98 'heavier':62 'ideal':80 'in-memori':15,103 'includ':30 'javascript':100 'librari':19,93 'lightweight':14 'like':64 'maintain':96 'make':78 'memori':4,9,17,102,105 'messag':76 'need':91 'node.js':21 'nodej':109,110 'oper':37 'pattern':50 'peek':40 'pop':39 'provid':34 'push':38 'queu':90 'queue':5,10,18,36,69,101,108,111 'releas':99 'remot':55 'requir':71 'resili':54 'retri':58 'server':88 'server-sid':87 'side':85,89 'simpl':2,7,82,112 'simple-in-memory-queu':1,6 'storag':74 'subscript':43 'type':31 'typescript':28,113 'unlik':61 'v1.1.7':11 'written':26","created_at":"2026-06-07T12:59:37.013382+00:00","updated_at":"2026-06-07T12:59:37.013382+00:00","problems":[{"fix":"Use correct import: import { createQueue } from 'simple-in-memory-queue';","cause":"Importing incorrectly, e.g., import Queue from 'simple-in-memory-queue' instead of named import.","error":"TypeError: queue.pop is not a function"},{"fix":"Create the queue first: const queue = createQueue(...); then queue.on.push.subscribe(...);","cause":"Trying to subscribe to events before creating the queue.","error":"Cannot read property 'subscribe' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ehmpathy/simple-in-memory-queue","github":"https://github.com/ehmpathy/simple-in-memory-queue","docs":null,"changelog":null,"pypi":null,"npm":"simple-in-memory-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}