DuckDB-Wasm gets persistent browser databases via OPFS — with a version gotcha
JeremyCMorgan · x · 2026-09-26
The DuckDB blog shows how to give DuckDB-Wasm a truly persistent database file using the browser's Origin Private File System (OPFS):
- Background: At launch in 2021, DuckDB-Wasm couldn't persist anything — apps serialized tables to Parquet in IndexedDB and re-registered them on load
- New approach: Modern browsers (since March 2023) ship OPFS, a per-origin sandboxed filesystem with random access. Opening a database at an opfs://analytics.duckdb path survives reloads and restarts, producing a regular .duckdb file with WAL and checkpoints
- Gotcha: The current npm latest (1.33.1-dev57.0) creates OPFS files but never writes to them — it canonicalizes the path to opfs:/analytics.duckdb (single slash), breaking the handle. Pin 1.32.0 or use 1.33.1-dev64.0+
- The post also explains exactly when data reaches disk via WAL and checkpointing
More from coding & agent
- Anthropic engineer on Claude Code effort levels: low to iterate, max for security — trq212 · 2026-09-26
- Anthropic engineer on Claude Code effort levels: low for staying in the loop, max for security audits — trq212 · 2026-09-26
- Anthropic publishes Claude plugin docs: skills, MCP Apps, and directory listing guide — ClaudeDevs · 2026-09-26
- Anthropic to roll out unified plugin discovery across Claude and Claude Code — ClaudeDevs · 2026-09-26
- Two ways to submit Claude plugins: single MCP connector or GitHub-hosted bundle — ClaudeDevs · 2026-09-26
- Claude plugin portal: submit via single MCP connector or GitHub-hosted bundle — ClaudeDevs · 2026-09-26