{"id":45570,"library":"node-persistent-queue","title":"node-persistent-queue","description":"A simple SQLite-backed FIFO queue for running many short tasks sequentially in Node.js event thread without blocking. Version 1.0.5, last released in 2018. Uses setImmediate() to allow event loop to poll between tasks. Differentiates from in-memory queues or worker threads by providing persistence via SQLite and promise-based API. Ideal for small tasks that must survive crashes/restarts.","status":"maintenance","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/damoclark/node-persistent-queue","tags":["javascript","sqlite","persistent","queue","node"],"install":[{"cmd":"npm install node-persistent-queue","lang":"bash","label":"npm"},{"cmd":"yarn add node-persistent-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-persistent-queue","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"SQLite driver for persistent storage","package":"better-sqlite3","optional":false},{"reason":"Debugging utility","package":"debug","optional":true}],"imports":[{"note":"CJS-only; no ESM or default export. Use require.","wrong":"import Queue from 'node-persistent-queue'","symbol":"Queue","correct":"const Queue = require('node-persistent-queue')"},{"note":"First argument is required (database path or ':memory:').","wrong":"new Queue()","symbol":"Queue instance","correct":"new Queue('./path/to/db.sqlite')"},{"note":"Events: start, stop, error, drain. Do not invoke callback in on().","wrong":"q.on('start', callback())","symbol":"events","correct":"q.on('start', callback)"}],"quickstart":{"code":"const Queue = require('node-persistent-queue');\nconst q = new Queue('./myqueue.sqlite');\nq.on('drain', () => console.log('All tasks done'));\nq.on('error', err => console.error(err));\nq.push({task: 'send-email', to: 'user@example.com'});\nq.on('task_finish', (task) => console.log('Finished', task));\nq.start();","lang":"javascript","description":"Creates a persistent queue, adds a task, and starts processing with event handlers."},"warnings":[{"fix":"Update Node.js to LTS version or use a more modern queue library.","message":"Requires Node.js >=6.0.0; may not work on newer versions with enhanced security.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Call q.start() after setting up event handlers.","message":"Queue must be started with .start() after adding listeners, or tasks will not be processed.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure directory exists and is writable.","message":"Database file path must be writeable; if path does not exist, it will be created. Using ':memory:' disables persistence.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Evaluate alternatives for active maintenance.","message":"Package not updated since 2018; consider migrating to more modern alternatives like Bull or Agenda.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.5':25 '2018':29 'allow':33 'api':58 'back':9 'base':57 'block':23 'crashes/restarts':66 'differenti':40 'event':20,34 'fifo':10 'ideal':59 'in-memori':42 'javascript':67 'last':26 'loop':35 'mani':14 'memori':44 'must':64 'node':2,71 'node-persistent-queu':1 'node.js':19 'persist':3,51,69 'poll':37 'promis':56 'promise-bas':55 'provid':50 'queue':4,11,45,70 'releas':27 'run':13 'sequenti':17 'setimmedi':31 'short':15 'simpl':6 'small':61 'sqlite':8,53,68 'sqlite-back':7 'surviv':65 'task':16,39,62 'thread':21,48 'use':30 'version':24 'via':52 'without':22 'worker':47","created_at":"2026-06-07T12:55:39.579500+00:00","updated_at":"2026-06-07T12:55:39.579500+00:00","problems":[{"fix":"Ensure first argument is a valid path; the table is created on first .push() call.","cause":"Database table 'jobs' not created automatically if instantiated incorrectly or database is empty.","error":"Error: SQLITE_ERROR: no such table: jobs"},{"fix":"Use 'new Queue(path)' instead of just 'Queue(path)'.","cause":"Queue instance not properly created, e.g., missing 'new'.","error":"TypeError: q.push is not a function"},{"fix":"Add q.on('error', console.error) before calling q.start().","cause":"No error listener attached; queue errors are emitted as 'error' events.","error":"events.js:167 throw er; // Unhandled 'error' event"}],"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/damoclark/node-persistent-queue","github":"https://github.com/damoclark/node-persistent-queue","docs":null,"changelog":null,"pypi":null,"npm":"node-persistent-queue","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}}