Registry / database / bedrock-sqlite

bedrock-sqlite

JSON →
library0.3.9jsnpmunverified

WASM build of SQLite (bedrock branch) that provides a better-sqlite3 compatible API. v0.3.9. Features support for BEGIN CONCURRENT and WAL2 journal mode. Runs in Node.js and browser environments via WebAssembly. Ships TypeScript types. Designed as a drop-in replacement for better-sqlite3 where WASM execution is desired. Release cadence is irregular; pre-v1.

npm install bedrock-sqlite
INSTALL
IMPORT
SIG · BEDROCK-SQLITE
B
bedrock-sqlite
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.

Database
import Database from 'bedrock-sqlite'
const Database = require('bedrock-sqlite')
Package is ESM-only in v0.3.x; CommonJS require will fail.
Database (type)
import type { Database } from 'bedrock-sqlite'
TypeScript consumers should use type import for type-only usage to avoid runtime side effects.
Statement
import Database, { Statement } from 'bedrock-sqlite'
import { Database, Statement } from 'bedrock-sqlite' (Database is default export)
Database is default export; named export for Statement is correct.

Create in-memory database, insert a row using prepared statement, retrieve it, and close the database.

import Database from 'bedrock-sqlite'; const db = new Database(':memory:'); db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT)'); const stmt = db.prepare('INSERT INTO test (value) VALUES (?)'); stmt.run('hello'); const row = db.prepare('SELECT * FROM test').get(); console.log(row); // { id: 1, value: 'hello' } db.close();
Debug
Known issues
breakingDatabase constructor is synchronous; no async initialization.
fix
Use synchronous new Database() call; no await needed.
affects: >=0
gotchaWASM file may not be bundled automatically; you may need to configure asset handling.
fix
Ensure your bundler copies the .wasm file to output, or use a WASM loader plugin.
affects: >=0
gotchaBEGIN CONCURRENT requires SQLite compiled with SQLITE_ENABLE_SETLK && SQLITE_ENABLE_LOCKING_STYLE=1; this is built into bedrock-sqlite but not standard SQLite WASM builds.
fix
Use BEGIN CONCURRENT only if you understand its concurrency model; it's not compatible with all environments.
affects: >=0
Errors
Common errors & fixes
Error: Cannot find module 'bedrock-sqlite' or its corresponding type declarations.
Package is ESM-only and the importing project does not have "type": "module" in package.json.
fix
Add "type": "module" to your package.json or use .mjs extension.
TypeError: Database is not a constructor
Incorrect import style: using named import { Database } instead of default import.
fix
Use import Database from 'bedrock-sqlite' (default import).
Error: WASM file not found: bedrock-sqlite.wasm
Bundler did not copy the .wasm asset to the output.
fix
Configure your bundler (e.g., webpack file-loader, Vite assetsInclude) to handle .wasm files.
Upgrade
Version history
0.3.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
20 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
bedrock-sqlite — npm install bedrock-sqlite · libregistry