Registry / database / sqlite-pool

sqlite-pool

JSON →
library1.2.5jsnpmunverified

A pooled SQLite client for Node.js that wraps the sqlite3 library with ES6 Promises, connection pooling, managed transactions, and an SQL-based migrations API. Originally based on the node-sqlite library, this package (v1.2.5) is stable but sees infrequent releases. It provides similar API to sqlite3 but with promise-based methods and no callbacks. Its key differentiator is connection pooling via generic-pool, allowing multiple connections with configurable min/max pool sizes, and automatic transaction management with commit/rollback. It includes legacy support for Node.js v5 and below.

npm install sqlite-pool
INSTALL
IMPORT
SIG · SQLITE-POOL
S
sqlite-pool
databasejavascriptv1.2.5
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.

Sqlite
const Sqlite = require('sqlite-pool')
import Sqlite from 'sqlite-pool'
Uses CommonJS require; ESM import is not supported.
Sqlite
const Sqlite = require('sqlite-pool/legacy')
const Sqlite = require('sqlite-pool')
Legacy path for Node.js v5 and lower.
db (instance)
const db = new Sqlite('./database.sqlite')
const db = Sqlite('./database.sqlite')
Must use 'new' keyword to instantiate.

Sets up an Express server with SQLite pool, using Promise.all to run concurrent queries in separate connections.

const express = require('express'); const Promise = require('bluebird'); const Sqlite = require('sqlite-pool'); const app = express(); const port = process.env.PORT || 3000; const db = new Sqlite('./database.sqlite', { Promise }); app.get('/post/:id', (req, res, next) => { return Promise.all([ db.get('SELECT * FROM Post WHERE id = ?', req.params.id), db.all('SELECT * FROM Category') ]).then(([post, categories]) => { res.render('post', { post, categories }); }).catch(next); }); app.listen(port);
Debug
Known issues
breakingRequires Node.js >= v6 for native Promise support; legacy require('sqlite-pool/legacy') for v5.
fix
Use legacy import for Node.js v5: require('sqlite-pool/legacy')
affects: >=1.0
gotchaAll database methods return Promises, not callbacks. Using callbacks will cause errors.
fix
Use .then() and .catch() or async/await instead of callbacks.
affects: >=1.0
gotchaThe 'new Sqlite()' constructor does not open connections immediately; it defers to generic-pool.
fix
Ensure database file is accessible when first query is executed.
affects: >=1.0
deprecatedBluebird Promise library is optional but recommended for wider compatibility.
fix
Pass { Promise: require('bluebird') } as second argument to use Bluebird.
affects: >=1.0
gotchasqlite3 must be installed as a peer dependency; not included automatically.
fix
Run npm install sqlite3 alongside sqlite-pool.
affects: >=1.0
Errors
Common errors & fixes
Cannot find module 'sqlite3'
sqlite3 is a peer dependency not auto-installed.
fix
Run 'npm install sqlite3' in your project.
TypeError: db.get is not a function
Used a method before database pool is initialized or used wrong import.
fix
Ensure you call 'new Sqlite()' and that the database file path is correct.
Error: SQLITE_BUSY: database is locked
Multiple connections trying to write simultaneously without proper isolation.
fix
Use db.use() with BEGIN IMMEDIATE to serialize writes.
ReferenceError: Promise is not defined
No Promise polyfill provided for Node.js v5 or lower.
fix
Use legacy import: require('sqlite-pool/legacy') or include a Promise library.
Upgrade
Version history
1.2.5latest on npm
Audit
Dependencies
generic-poolrequiredConnection pooling for SQLite
sqlite3requiredSQLite database driver
bluebirdoptionalOptional Promise implementation
Agent activity
13 hits · last 30 days
node
10
Meta
1
OpenAI (training)
1
Resources
sqlite-pool — npm install sqlite-pool · libregistry