Registry / database / sqlite-to-json

sqlite-to-json

JSON →
library0.1.3jsnpmunverified

sqlite-to-json is a small Node.js library that dumps SQLite database tables to JSON files. At version 0.1.3, it provides a simple class with methods to list tables, save individual tables as JSON, and export the entire database as a single JSON object. It depends on the native sqlite3 driver, which requires compilation. The package has not seen recent updates (last release appears old) and may have limited maintenance.

npm install sqlite-to-json
INSTALL
IMPORT
SIG · SQLITE-TO-JSON
S
sqlite-to-json
databasejavascriptv0.1.3
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 SqliteToJson = require('sqlite-to-json');
import SqliteToJson from 'sqlite-to-json';
The package exports a single constructor function via module.exports; ESM import may fail depending on Node version.

Initializes the exporter with a sqlite3 database instance, lists tables, saves a table to JSON, and exports the whole database.

const SqliteToJson = require('sqlite-to-json'); const sqlite3 = require('sqlite3'); const exporter = new SqliteToJson({ client: new sqlite3.Database('./mydb.sqlite3'), }); // List all tables exporter.tables((err, tables) => { if (err) throw err; console.log('Tables:', tables); }); // Save a table to JSON exporter.save('users', './users.json', (err) => { if (err) throw err; console.log('Saved users table'); }); // Export entire database exporter.all((err, data) => { if (err) throw err; console.log('All data:', JSON.stringify(data, null, 2)); });
Debug
Known issues
gotchaThe sqlite3 package is a native module that requires compilation; ensure build tools are installed (e.g., python, make, gcc).
fix
Install build tools via your OS package manager or use prebuilt binaries via `npm install sqlite3 --build-from-source`.
affects: >=0.1.0
gotchaThe exporter constructor expects a `client` property with a `sqlite3.Database` instance; passing a different type will cause runtime errors.
fix
Pass `{ client: new sqlite3.Database(path) }` exactly.
affects: >=0.1.0
gotchaCallbacks are required; omitting them will cause silent failures or crashes.
fix
Always provide a callback function to `tables`, `save`, and `all` methods.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'sqlite3'
sqlite3 is a peer dependency but not installed.
fix
Run `npm install sqlite3` in your project.
TypeError: exporter.tables is not a function
Using ESM import incorrectly or constructing the exporter without 'new'.
fix
Use `const SqliteToJson = require('sqlite-to-json');` then `new SqliteToJson(opts)`.
Upgrade
Version history
0.1.3latest on npm
Audit
Dependencies
sqlite3requiredRequired for database connectivity; not included as a direct dependency, must be installed separately.
Agent activity
15 hits · last 30 days
node
12
Meta
1
OpenAI (training)
1
Resources
sqlite-to-json — npm install sqlite-to-json · libregistry