A fork of sql.js with R-Tree spatial indexing support. Version 1.7.0 (stable). This library compiles SQLite to JavaScript via Emscripten, enabling in-memory SQL databases in browsers and Node.js. Key differentiator: includes SQLite R-Tree extension for spatial queries, which the upstream sql.js does not enable by default. Same API as sql.js: create, query, export databases using pure JavaScript. Release cadence is sporadic, tied to upstream updates and patches for the R-Tree feature. Not to be confused with native SQLite3 bindings for Node.js; this is a pure in-memory implementation loading entire DB into memory.
npm install rtree-sql.jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to load the library, create an in-memory database, create a table, insert data, and query using prepared statements.
Call db.export() to get Uint8Array and persist via localStorage or file download.
Ensure you await initSqlJs() at the top level before using SQL.Database.
Set locateFile to point to the directory containing sql-wasm.wasm (e.g., from node_modules or CDN).
Wrap code in async function and await initSqlJs(config).
try { new SQL.Database(data) } catch(e) { ... }Ensure initSqlJs() is awaited: const SQL = await initSqlJs();
Run npm install rtree-sql.js and use require('rtree-sql.js').Always await initSqlJs() first; do not reuse a closed database.
No dependency data recorded yet.