Registry / database / node-sqlite-purejs

node-sqlite-purejs

JSON →
library0.0.2jsnpmunverified

SQLite compiled to JavaScript via Emscripten, providing a pure-JS SQLite implementation that avoids native C bindings and node-gyp compilation. Current version 0.0.2, with no clear release cadence. This package is a fork or wrapper around sql.js, offering a callback-based API for opening databases and executing SQL. It is distinct from sql.js in its API style and is less commonly maintained. Suitable for environments where native modules cannot be compiled.

npm install node-sqlite-purejs
INSTALL
IMPORT
SIG · NODE-SQLITE-PUREJS
N
node-sqlite-purejs
databasejavascriptv0.0.2
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
const Sql = require('node-sqlite-purejs');
import Sql from 'node-sqlite-purejs';
CJS only; no ESM support.
open
Sql.open(path, options, callback)
sqlite.open(path, options, callback)
Method is attached to the default export.
exec
db.exec(sql, callback)
db.execute(sql, callback)
Use exec, not execute.

Opens a SQLite database, creates a table, inserts a row, and queries it using the callback-based API.

const Sql = require('node-sqlite-purejs'); Sql.open('test.db', {}, (err, db) => { if (err) throw err; db.exec("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT);", (err2) => { if (err2) throw err2; db.exec("INSERT INTO users VALUES (1, 'Alice');", (err3) => { if (err3) throw err3; db.exec("SELECT * FROM users;", (err4, rows) => { if (err4) throw err4; console.log(rows); }); }); }); });
Debug
Known issues
deprecatedThis package is unmaintained and may not support newer SQLite features.
fix
Consider using sql.js or better-sqlite3 instead.
affects: >=0.0.2
gotchaAll database operations are asynchronous with callbacks, no Promise support.
fix
Wrap callbacks in Promises if needed, or use a library that supports async/await.
affects: >=0.0.0
gotchaNo TypeScript typings provided; all types are inferred.
fix
Use a type declaration file or switch to a typed library.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'node-sqlite-purejs'
Package not installed or version not found.
fix
Run 'npm install node-sqlite-purejs' in your project.
TypeError: Sql.open is not a function
Incorrect import style (e.g., using ES import instead of require).
fix
Use 'const Sql = require('node-sqlite-purejs');'.
Error: ER_CALLBACK_INVALID: Callback argument must be a function
Missing or invalid callback parameter.
fix
Pass a function as the last argument to open or exec.
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
node-sqlite-purejs — npm install node-sqlite-purejs · libregistry