Source

Per-origin sandboxed file system, rooted at navigator.storage.getDirectory().

  • Not visible in the user’s real filesystem, wiped when site data is cleared.
  • Main thread only gets async handles: getFileHandle, createWritable
  • Workers get createSyncAccessHandle(): synchronous read/write/truncate/flush at a byte offset
    • Exclusive lock, one open handle per file
    • Effectively pread/pwrite, which is what C compiled to WASM already assumes it has
  • IndexedDB can’t back a storage engine: async, and keyed on whole values rather than byte ranges, so every page read needs a shim
  • SQLite and DuckDB both ship an OPFS VFS for this reason
  • Evictable under storage pressure unless navigator.storage.persist() is granted

See also: local-first software, databases