Context:
The Origin Private File System (OPFS) allows origins to store
data consistent with the
https://storage.spec.whatwg.org/
Storage Living Standard in browser-managed storage that is
explicitly separate from the rest of the user’s filesystem or
data stored by other origins. The stored “site data” is
reported and cleared by existing privacy and data management UI
as covered by
https://support.mozilla.org/en-US/kb/clear-cookies-and-site-data-firefox.
There are other proposed APIs that relate to allowing origins
access to the user’s file system through explicit semi-durable
grants, but we are not implementing or considering implementing
those APIs at this time due to concerns about how to safely
provide users with informed consent about providing origins with
ongoing access to their file system.
OPFS is an important step forward in exposing storage primitives
to the web that can be reasonably standardized while allowing
the web platform to do powerful things more efficiently to
reduce resource usage by the browser. For example,
https://github.com/simonw/datasette-lite is a tool built on top
of SQLite running in the browser using WebAssembly. SQLite
compiled to WASM already works in the browser today, but is
limited in efficiency by IndexedDB and the Cache API only
providing immutable Blob/File/Response abstractions.
By providing primitives that allow efficient use of SQLite in
the browser, we’re fulfilling the dream of Web SQL Database
(
https://en.wikipedia.org/wiki/Web_SQL_Database) which was
impossible to standardize because it was just exposing the
SQLite implementation to the web. (It was also not a great idea
from a security perspective, and indeed resulted in a number of
security bugs, as SQLite was never meant to be exposed to
adversarial code.)
OPFS will also enable other resource intensive web applications
such as image editors, video editors, etc.