Skip to main content
OPFSVFS mounts the Origin Private File System: files persist across page reloads and stay scoped to the page’s origin. It needs no service and no credentials; see the OPFS page.
Browser only. Node has no OPFS; for local files in Node, use Disk.

Install

Configure

capacity: '100MB' caps the bytes the folder holds; a write past it fails with “Disk quota exceeded”. See capacity. A mount takes MountMode.READ, WRITE or EXEC.

Fields

Layout

With root: 'mirage', /data/drafts/plan.md is mirage/drafts/plan.md in the origin’s OPFS.

Behavior

  • Origin scope: another origin, or another browser profile, sees none of the files.

Storage and quotas

The browser sets a quota per origin, typically a fraction of free disk. A write past it fails with QuotaExceededError.
Under storage pressure the browser may evict the data. For a long-lived workspace, ask for persistent storage early:
See TypeScript Limitations: Browser for every browser constraint.