{"id":45994,"library":"queue.io","title":"queue.io","description":"Event-based queue iteration library for JavaScript (v2.3.0). Allows creating asynchronously filled queues from event emitters or iterables, then iterating over them with forward/backward directions. Supports appending, prepending (listen), and intercepting queues. Key differentiator: queues can be populated before or after iterators are created, and multiple independent iterators can traverse the same queue in different directions. Depends on Node.js EventEmitter. Not heavily maintained (last update years ago).","status":"maintenance","version":"2.3.0","language":"javascript","source_language":"en","source_url":"git://github.com/Lcfvs/queue.io","tags":["javascript","queue","iterable","iteration","iterator","iterate","event","evented","asynchronous"],"install":[{"cmd":"npm install queue.io","lang":"bash","label":"npm"},{"cmd":"yarn add queue.io","lang":"bash","label":"yarn"},{"cmd":"pnpm add queue.io","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Uses Node.js EventEmitter as optional event source","package":"events","optional":true}],"imports":[{"note":"Default export; ESM import preferred.","wrong":"const Queue = require('queue.io')","symbol":"Queue","correct":"import Queue from 'queue.io'"},{"note":"In CommonJS, the default export is accessed via .default.","wrong":"const Queue = require('queue.io')","symbol":"Queue","correct":"const Queue = require('queue.io').default"},{"note":"NEXT and PREV are static properties on the Queue class, not named exports.","wrong":"import { NEXT } from 'queue.io'","symbol":"Queue.NEXT","correct":"import Queue from 'queue.io'; Queue.NEXT"}],"quickstart":{"code":"import Queue from 'queue.io';\nimport { EventEmitter } from 'events';\n\nconst emitter = new EventEmitter();\nconst queue = Queue(emitter, 'value');\n\nemitter.emit('value', 1);\nemitter.emit('value', 2);\nemitter.emit('value', 3);\nemitter.emit('done');\n\nconst iterator = queue.iterate();\niterator.on('value', (data) => {\n  console.log('Value:', data.value);\n  if (data.value < 3) {\n    data.next();\n  }\n});\niterator.on('done', () => {\n  console.log('Iteration done');\n});","lang":"javascript","description":"Creates a queue from an EventEmitter, pushes values, then iterates forward consuming until done."},"warnings":[{"fix":"Use native async iteration with for-await-of or libraries like iter-ops.","message":"The package uses an older EventEmitter pattern; consider using async iterators for modern code.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Convert iterables to arrays first: Queue.from([...set]).","message":"Queue.from does not accept generic iterables (only array-like objects). Passing a Set or Map may not work as expected.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Always provide an eventEmitter or use Queue.from to avoid unexpected done.","message":"If no eventEmitter is provided, the queue auto-dones at next tick only if no queues are joined via intercept/listen/append. This can cause premature done if not joined.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"search_vec":"'ago':69 'allow':11 'append':29 'asynchron':13,78 'base':4 'creat':12,46 'depend':59 'differ':57 'differenti':36 'direct':27,58 'emitt':18 'event':3,17,76,77 'event-bas':2 'eventemitt':62 'fill':14 'forward/backward':26 'heavili':64 'independ':49 'intercept':33 'iter':6,20,22,44,50,72,73,74,75 'javascript':9,70 'key':35 'last':66 'librari':7 'listen':31 'maintain':65 'multipl':48 'node.js':61 'popul':40 'prepend':30 'queue':5,15,34,37,55,71 'queue.io':1 'support':28 'travers':52 'updat':67 'v2.3.0':10 'year':68","created_at":"2026-06-07T12:57:45.412874+00:00","updated_at":"2026-06-07T12:57:45.412874+00:00","problems":[{"fix":"Ensure you are using the default export: import Queue from 'queue.io' then call Queue() to create a queue.","cause":"Importing incorrectly in ESM or CJS environment.","error":"TypeError: queue.iterate is not a function"},{"fix":"Call iterate() only after the queue is done, or ensure events are listened after iterator creation.","cause":"Calling iterator.on before queue has been filled and done.","error":"Uncaught TypeError: Cannot read properties of undefined (reading 'on')"},{"fix":"Emit emitter.emit('done') after all values are pushed.","cause":"Forgetting to emit 'done' on the eventEmitter when using custom emitter.","error":"Error: done event must be emitted on the eventEmitter"}],"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/Lcfvs/","github":"git://github.com/Lcfvs/queue.io","docs":null,"changelog":null,"pypi":null,"npm":"queue.io","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"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}}