Registry / database / jspard-sqlite

jspard-sqlite

JSON →
library0.0.18jsnpmunverified

jspard-sqlite is a lightweight SQLite wrapper for JavaScript/TypeScript (currently v0.0.18, pre-1.0). It provides a simple promise-based API for executing SQL queries on SQLite databases. Key differentiators: zero dependencies, minimal overhead, and direct SQL execution without ORM features. Release cadence is irregular. Suitable for small projects or quick prototyping where full-featured solutions like better-sqlite3 or sql.js are overkill.

npm install jspard-sqlite
INSTALL
IMPORT
SIG · JSPARD-SQLITE
J
jspard-sqlite
databasejavascriptv0.0.18
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 (JspardSqlite)
✓ import JspardSqlite from 'jspard-sqlite'
✗ const JspardSqlite = require('jspard-sqlite')
Package uses default export; CommonJS require works but not typical for ESM projects.
open
✓ import { open } from 'jspard-sqlite'
✗ import open from 'jspard-sqlite'
Named export for opening a database; avoid default import for this function.
Database
✓ import { Database } from 'jspard-sqlite'
✗ import Database from 'jspard-sqlite'
TypeScript type definition for Database instances.

Opens a SQLite database, creates a table, inserts a row, and selects all rows using async/await.

import { open } from 'jspard-sqlite'; async function main() { const db = await open('test.db'); await db.run('CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT)'); await db.run('INSERT INTO users (name) VALUES (?)', ['Alice']); const rows = await db.all('SELECT * FROM users'); console.log(rows); await db.close(); } main().catch(console.error);
Debug
Known issues
gotchaDatabase file is created if it does not exist; ensure correct path to avoid unintended file creation.
fix
Use ':memory:' for in-memory database to avoid file creation.
affects: >=0.0.1
gotchaQuery parameters must be passed as an array even for single values.
fix
Always pass parameters as an array, e.g., db.run('INSERT INTO t VALUES (?)', [value]).
affects: >=0.0.1
gotchaPackage uses native SQLite binding; may not work in browsers or non-Node environments.
fix
Use sql.js or similar if browser compatibility is required.
affects: >=0.0.1
Errors
Common errors & fixes
Error: Cannot find module 'jspard-sqlite'
Package not installed; missing from node_modules.
fix
Run 'npm install jspard-sqlite' in your project directory.
TypeError: db.run is not a function
Attempted to use db before it is fully initialized (async open).
fix
Ensure you await open() or use .then() before calling methods on db.
Error: SQLITE_ERROR: no such table: users
Table not created before querying; or using wrong database file.
fix
Run CREATE TABLE statement before SELECT. Check database file path.
Upgrade
Version history
0.0.18latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
10
Resources
jspard-sqlite — npm install jspard-sqlite · libregistry