TL;DR
DuckDB-Wasm now supports persistent databases in the browser using the Origin Private File System (OPFS), allowing data to survive page reloads and browser restarts. This advancement simplifies data management for web applications by eliminating the need for manual serialization and storage.
✦ Why It Matters
Start using DuckDB-Wasm with OPFS today to simplify persistent data management in your web applications.
Key Takeaways
Full Summary
Previously, DuckDB-Wasm, a WebAssembly version of the DuckDB database, could not persist data, as it only existed in memory and was lost when the browser tab closed. Developers had to serialize data to Parquet format and store it in IndexedDB, which required additional application-level handling.
With the introduction of the Origin Private File System (OPFS) in modern browsers, DuckDB-Wasm can now open a persistent database file directly in OPFS. This allows for random-access reads and writes, with features like a write-ahead log and checkpoints that ensure data integrity.
Tested with versions 1.32.0 and 1.33.1-dev64.0, this integration means that databases can now survive page reloads and browser restarts seamlessly. This change significantly enhances the usability of DuckDB-Wasm for developers looking to manage persistent data in web applications.
Related