Registry / database / sqlite-sync

sqlite-sync

JSON →
library0.3.9jsnpmunverified

A lightweight Node.js module for SQLite database operations supporting both synchronous and asynchronous execution. Current stable version is 0.3.9 (last updated 2016). It provides simple wrappers for connect, run, insert, update, and close operations, with a callback-based async API and synchronous variants. Key differentiator is the mixed sync/async support, but it is outdated and lacks modern features like promises, ESM, or TypeScript definitions. Not recommended for new projects.

npm install sqlite-sync
INSTALL
IMPORT
SIG · SQLITE-SYNC
S
sqlite-sync
databasejavascriptv0.3.9
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.

default (require)
const sqlite = require('sqlite-sync');
No ESM or named export; must use CommonJS require. No default export for ES modules.
connect
sqlite.connect('path/to/db');
const db = sqlite.connect('path/to/db');
connect does not return a connection object; it modifies the module's internal state.
run
sqlite.run('SQL', callback);
const res = sqlite.run('SQL');
run can be used synchronously without callback, but async usage requires callback.

Basic setup: connecting to a database, creating a table, inserting a row (async), and querying all rows (sync).

const sqlite = require('sqlite-sync'); sqlite.connect('test.db'); sqlite.run("CREATE TABLE IF NOT EXISTS items (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT)", res => { if (res.error) throw res.error; console.log('Table created'); }); sqlite.insert("items", {name: "example"}, res => { if (res.error) throw res.error; console.log('Inserted with ID:', res.insertId); }); const rows = sqlite.run("SELECT * FROM items"); console.log(rows); sqlite.close();
Debug
Known issues
deprecatedPackage is no longer actively maintained; last update in 2016.
fix
Migrate to a maintained alternative like better-sqlite3 or sql.js.
affects: >=0.3
gotchaCallbacks have inconsistent signatures: some return {error, ...}, others return raw rows.
fix
Always check for res.error before assuming success, and consult the wiki for each method's return format.
affects: >=0.1
gotchaThe module modifies internal state on connect; you can only have one connection at a time.
fix
Use a different package if you need multiple concurrent connections.
affects: >=0.1
gotchaSynchronous operations block the event loop, which can cause performance issues or crashes for large queries.
fix
Prefer async callbacks or use async/await with a wrapper; better yet, switch to an async-native library.
affects: >=0.1
Errors
Common errors & fixes
Cannot find module 'sqlite-sync'
Package not installed or missing from node_modules.
fix
Run `npm install sqlite-sync` in your project root.
TypeError: sqlite.connect is not a function
Incorrect import or the package is not CommonJS compatible.
fix
Use `const sqlite = require('sqlite-sync');` instead of ES module imports.
Error: SQLITE_MISUSE: not an error
Calling methods after closing the connection.
fix
Do not call sqlite.run() or other methods after sqlite.close().
Upgrade
Version history
0.3.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
18
Meta
2
OpenAI (training)
1
Resources
sqlite-sync — npm install sqlite-sync · libregistry