sqlite-worker is a persistent SQLite database library for Web pages, Web Workers, and Service Workers (v0.9.0). It wraps sql.js and sqlite-tag to provide a tagged template literal API for queries, with automatic persistence via IndexedDB. Unlike sql.js alone, it manages the database file lifecycle and offers both main-thread (init) and worker-based (SQLiteWorker) execution. The library requires manual dist folder path configuration in Worker contexts due to a browser bug. Release cadence is irregular; latest version is 0.9.0.
npm install sqlite-workerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows two initialization methods (worker vs main thread) and basic CRUD with tagged template literals.
Provide dist option: SQLiteWorker({ dist: './dist/', name: 'my-db' })Use importScripts and call the global sqliteWorker function, not the ES import.
Use query for standalone queries; for transactions, use the transaction function returned by init/SQLiteWorker.
In Workers, use importScripts('./dist/sw.js') or provide dist option to SQLiteWorker.Run: npm install sql.js sqlite-worker