Registry / storage / better-queue-sqlite

better-queue-sqlite

JSON →
library1.0.7jsnpmunverified

SQLite store adapter for the better-queue task queue library. Version 1.0.7 is the latest stable release. The package provides a persistent store backed by SQLite, enabling queue durability and crash recovery. It integrates with better-queue's store interface and supports concurrency and retries. The package is lightweight and requires only better-queue as a peer dependency. It is suitable for Node.js applications needing a simple, file-based queue with SQL persistence.

npm install better-queue-sqlite
INSTALL
IMPORT
SIG · BETTER-QUEUE-SQLIT
B
better-queue-sqlite
storagejavascriptv1.0.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.

SqliteStore
import SqliteStore from 'better-queue-sqlite'
const SqliteStore = require('better-queue-sqlite').default
Default import works with ESM; CommonJS require() returns the constructor directly.
SqliteStore
const SqliteStore = require('better-queue-sqlite')
const { SqliteStore } = require('better-queue-sqlite')
CommonJS exports the constructor directly, not as a named export.
SqliteStore
import SqliteStore from 'better-queue-sqlite'
import { SqliteStore } from 'better-queue-sqlite'
There is no named export; use default import.

Shows how to create a SQLite store for better-queue with custom options and push a task.

import Queue from 'better-queue'; import SqliteStore from 'better-queue-sqlite'; const store = new SqliteStore({ path: './my-queue.db', maxRetries: 3, retryDelay: 1000 }); const q = new Queue( (input, cb) => { // Process task cb(null, `Processed ${input}`); }, { store: store } ); q.push('task1'); q.on('task_finish', (taskId, result) => { console.log(`Task ${taskId} finished: ${result}`); });
Debug
Known issues
gotchaThe store object must be instantiated before creating the Queue instance, not passed as a class reference.
fix
Create the store instance first: const store = new SqliteStore(opts); then pass it to Queue.
affects: >=0.0.0
gotchaThe SQLite database file path is relative to the current working directory unless an absolute path is provided.
fix
Use path.resolve(__dirname, 'queue.db') to ensure the database file is in the expected location.
affects: >=0.0.0
gotchaIf the SQLite file cannot be created (e.g., permissions), the store constructor will throw synchronously.
fix
Wrap store instantiation in a try-catch or ensure the directory has write permissions.
affects: >=0.0.0
deprecatedThe option 'maxRetries' is misspelled as 'maxRetries' in the store constructor; check better-queue documentation for the correct option name.
fix
Use the options from better-queue's store interface; the store adapter inherits options from better-queue.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'better-queue'
better-queue is not installed
fix
Run npm install better-queue
TypeError: SqliteStore is not a constructor
Importing the module incorrectly in CommonJS (using named import instead of default)
fix
Use const SqliteStore = require('better-queue-sqlite');
Upgrade
Version history
1.0.7latest on npm
Audit
Dependencies
better-queuerequiredRequired as a peer dependency for the queue functionality.
Agent activity
24 hits · last 30 days
node
20
Resources
better-queue-sqlite — npm install better-queue-sqlite · libregistry