If you have ever clicked a 300 MB .sqlite database or a bloated Cursor/VS Code state.vscdb file inside VS Code, you have probably hit either an out-of-memory webview crash or a hard "Database is too large" paywall around 200 MB.
The cause is simple: to avoid native C++ .node binary mismatches across Windows, Apple Silicon, Linux ARM64, and Remote-SSH, most SQLite extensions load the entire file into a single Uint8Array inside the webview.
The clean architecture: wa-sqlite + a custom Node disk VFS
Instead of loading the database into memory, you can run wa-sqlite in the VS Code Extension Host and override VFS.Base so SQLite's 4 KB page reads translate straight to fs.readSync:
override xRead(fileId: number, pData: Uint8Array, iOffset: number): number {
const handle = this.openFiles.get(fileId);
if (!handle) return VFS.SQLITE_IOERR_READ;
const n = fs.readSync(handle.fd, pData, 0, pData.byteLength, iOffset);
if (n < pData.byteLength) {
pData.fill(0, n);
return VFS.SQLITE_IOERR_SHORT_READ;
}
return VFS.SQLITE_OK;
}
Two practical gotchas we hit while shipping this in RowSlate:
-
mxPathName = 64default inVFS.Base: Long paths or non-ASCII directories get truncated unless you raisemxPathNameand map short ASCII aliases (/rs_1.db) to the real filesystem path (preserving-waland-journalsidecars). -
Passing
wasmBinary: fs.readFileSync(...): Emscripten's default loader callsfetch()on a local path in Node and throwsERR_INVALID_URL. SupplyingwasmBinarydirectly works offline across every OS with zero network calls.
Measured benchmark on a 2-vCPU ARM Linux box
- 254.5 MB SQLite database: open + schema inspection + page 1 + jump to row 60,000 took 1,002 ms with only +30.7 MB RSS.
- 237.8 MB CSV (2.6M rows): 64-row milestone byte-offset index built in 1.5 s (+2.7 MB RSS), random seek to row 2,500,000 in 3 ms.
Try it free (unlimited file sizes) via RowSlate or inspect Parquet/Excel/CSV files zero-upload in your browser at lukaslabs.top/tools/parquet-viewer.
(Disclosure: Built independently at Lukas Labs.)
Top comments (0)