This article explains how to leverage the browser's Origin Private File System (OPFS) to enable persistent storage for DuckDB-Wasm. It provides the necessary configuration steps to move from in-memory database storage to file-backed persistence that survives browser restarts.
Key points
DuckDB-Wasm now supports persistent storage by opening database files directly within the browser's Origin Private File System (OPFS).
Persistence requires specific version compatibility; developers should use DuckDB-Wasm 1.32.0 or the 'next' branch to ensure correct OPFS path handling.
The persistent backend allows for standard SQL workflows, including write-ahead logging (WAL) and checkpointing, in client-side applications.
Efficient persistence performance is achieved by managing CHECKPOINT frequency after batches of writes rather than individual statements.