queue2.js v0.2.1 is a specialized Node.js queue data structure that combines unordered and ordered queuing with injection capabilities. Created by fent, it allows tasks to be executed concurrently with a configurable concurrency limit while supporting ordered processing through task injection. The first worker handles unordered tasks with an inject method to replace the current task with a sequence of ordered tasks. It requires Node >=4 and has no external dependencies. The package is in maintenance mode with no recent updates, and its API includes event emitters for error, drain, full, and empty events. It is a niche solution for specific use cases like asynchronous file reading with ordered subdirectory traversal.
npm install queue2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a Queue2 with two workers and concurrency 2, pushes unordered tasks, and handles completion via callback and drain event.
Check if this.inject was called before calling callback, or use inject only without callback.
Ensure the callback is the last argument matching worker1's callback position.
Consider migrating to modern alternatives like p-limit or async.queue.
Import with named import: import { Queue2 } from 'queue2';Use dynamic import() for ESM: const { Queue2 } = await import('queue2'); or set type:"module" in package.json.Attach a listener: queue.on('error', (err) => console.error(err));No dependency data recorded yet.