{"_id":"@emdzej/csfs-opfs","_rev":"4-ac843691977f7c85ff20cdb9af7f55f6","name":"@emdzej/csfs-opfs","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@emdzej/csfs-opfs","version":"0.1.0","keywords":["filesystem","browser","zip","range-requests","opfs","file-system-access","http"],"license":"MIT","_id":"@emdzej/csfs-opfs@0.1.0","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/csfs/tree/main/packages/opfs#readme","bugs":{"url":"https://github.com/emdzej/csfs/issues"},"dist":{"shasum":"6f5682cfe5564757b39f78a6d95831fbabe1f958","tarball":"https://registry.npmjs.org/@emdzej/csfs-opfs/-/csfs-opfs-0.1.0.tgz","fileCount":7,"integrity":"sha512-P1A6q+v3eI3UVn7mp3n1wTVCyHqtAhIkt/Yzbu5r4Isg/dJbHPRaxhQyS8836pByCz4vwuUE1s3ppHaP44ewKA==","signatures":[{"sig":"MEQCIBNwjet5R0F8ym8sar4265Vm4e42fMYRD0+0XFVngEK4AiBMtdCeWKC+VKq2+6obQD06+dh9SaLwbaZTxJdYQdr2Dg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12438},"main":"dist/index.js","type":"module","_from":"file:emdzej-csfs-opfs-0.1.0.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/20450d3d01b351f71f8b5d89d5d026bb/emdzej-csfs-opfs-0.1.0.tgz","_integrity":"sha512-P1A6q+v3eI3UVn7mp3n1wTVCyHqtAhIkt/Yzbu5r4Isg/dJbHPRaxhQyS8836pByCz4vwuUE1s3ppHaP44ewKA==","repository":{"url":"git+https://github.com/emdzej/csfs.git","type":"git","directory":"packages/opfs"},"_npmVersion":"11.16.0","description":"File system over the origin private file system","directories":{},"_nodeVersion":"22.22.1","dependencies":{"@emdzej/csfs-fsa":"0.1.0","@emdzej/csfs-core":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/csfs-opfs_0.1.0_1788549010044_0.05163316246858107","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@emdzej/csfs-opfs","version":"0.1.1","keywords":["filesystem","browser","zip","range-requests","opfs","file-system-access","http"],"license":"MIT","_id":"@emdzej/csfs-opfs@0.1.1","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/csfs/tree/main/packages/opfs#readme","bugs":{"url":"https://github.com/emdzej/csfs/issues"},"dist":{"shasum":"17daa899fb4eef034698fa8d6e03e0e5108b9d15","tarball":"https://registry.npmjs.org/@emdzej/csfs-opfs/-/csfs-opfs-0.1.1.tgz","fileCount":7,"integrity":"sha512-5ZqSpFThcxj9LilETcW0HwkeBYTxcc/qSLu9dH+GcmhjvqgPPhIUcEnqiBhRNi9sozYT2zyH0A79GMBK+bX4bA==","signatures":[{"sig":"MEQCIC2utkG5/ZMQlGzOzR2OGkqLYoZ/QIBsre3KtX7jRb/TAiAXPtJqDpe5VPvQgihV3wTnBWWDufrtpZta/Rb0BUxQ6g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12438},"main":"dist/index.js","type":"module","_from":"file:emdzej-csfs-opfs-0.1.1.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/6b4b242782ccf9a7676a12d408ae5653/emdzej-csfs-opfs-0.1.1.tgz","_integrity":"sha512-5ZqSpFThcxj9LilETcW0HwkeBYTxcc/qSLu9dH+GcmhjvqgPPhIUcEnqiBhRNi9sozYT2zyH0A79GMBK+bX4bA==","repository":{"url":"git+https://github.com/emdzej/csfs.git","type":"git","directory":"packages/opfs"},"_npmVersion":"11.16.0","description":"File system over the origin private file system","directories":{},"_nodeVersion":"22.22.1","dependencies":{"@emdzej/csfs-fsa":"0.1.1","@emdzej/csfs-core":"0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/csfs-opfs_0.1.1_1788968569678_0.5945464307919832","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@emdzej/csfs-opfs","version":"0.2.0","keywords":["filesystem","browser","zip","range-requests","opfs","file-system-access","http"],"license":"MIT","_id":"@emdzej/csfs-opfs@0.2.0","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"homepage":"https://github.com/emdzej/csfs/tree/main/packages/opfs#readme","bugs":{"url":"https://github.com/emdzej/csfs/issues"},"dist":{"shasum":"0c019178de05e9572d1d0b6c141145d4514fd916","tarball":"https://registry.npmjs.org/@emdzej/csfs-opfs/-/csfs-opfs-0.2.0.tgz","fileCount":7,"integrity":"sha512-Nk5D9ZWQK9NHAKHqGRfxZVniQb8CpnQ8hmTyg4MwZK2retOQLo1EW8xHoML6rSAy5QSd6cfmu4JXprmCnJ9j2Q==","signatures":[{"sig":"MEQCIDnTkJIs/aJ7zsjlELOZu05aYFAdQmjLkP7RtEDNrYxAAiB7tvLs2hys0DL+syK7meDXt9WOT4TenvLiVPc14WnylA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIHYk4xTKci406/TNgeYVAauiyBImOnXCr8JsGh7Pnx/sAiBPFcdUOF1ovdxzo2oWWd0O3yndEXJ1kJqsyEapJdORWg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12438},"main":"dist/index.js","type":"module","_from":"file:emdzej-csfs-opfs-0.2.0.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"emdzej","email":"michal@jaskolski.pro"},"_resolved":"/private/var/folders/7h/x_w_580x4s9dq3sq11tpvzkwy3nbj8/T/69a3102bbd12b210c7993196bef40da5/emdzej-csfs-opfs-0.2.0.tgz","_integrity":"sha512-Nk5D9ZWQK9NHAKHqGRfxZVniQb8CpnQ8hmTyg4MwZK2retOQLo1EW8xHoML6rSAy5QSd6cfmu4JXprmCnJ9j2Q==","repository":{"url":"git+https://github.com/emdzej/csfs.git","type":"git","directory":"packages/opfs"},"_npmVersion":"11.16.0","description":"File system over the origin private file system","directories":{},"_nodeVersion":"22.22.1","dependencies":{"@emdzej/csfs-fsa":"0.2.0","@emdzej/csfs-core":"0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.13.1"},"_npmOperationalInternal":{"tmp":"tmp/csfs-opfs_0.2.0_1789548619819_0.6613329544575666","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"_id":"@emdzej/csfs-opfs@0.3.0","bugs":{"url":"https://github.com/emdzej/csfs/issues"},"dist":{"shasum":"e7c0e47f3ea1279c79861ba788b7f03250e24b61","tarball":"https://registry.npmjs.org/@emdzej/csfs-opfs/-/csfs-opfs-0.3.0.tgz","fileCount":7,"integrity":"sha512-dHipXfdvotZ5ryhndnY68a8V5Zhml7WkiPfNHJCwzIgHFbkT5b8/IZeEFlTsSxkyFk99I2BUvmS2ODIofyEh7Q==","signatures":[{"sig":"MEYCIQCVoV/7HILFG4S2HB7pCf7m+8efCUV8zY3dZgMg2ErjrgIhAOKMhWOtERlB7x7QRTYDwQGsqLHT2klaIoHQLyimnzCM","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDx2J8DhRG+/XLAtj68S+EZ2+q6C91jBJxCVnHJDR+2uwIhAMWBeNE0z6W6AXz5eDphfuWS+NwDz6QnFEfBv+c7lTkS"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@emdzej%2fcsfs-opfs@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":15887},"main":"dist/index.js","name":"@emdzej/csfs-opfs","type":"module","_from":"file:dist-npm/emdzej-csfs-opfs-0.3.0.tgz","types":"dist/index.d.ts","engines":{"node":">=22"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"license":"MIT","scripts":{"build":"tsc -b","clean":"rm -rf dist .turbo *.tsbuildinfo","typecheck":"tsc --noEmit"},"version":"0.3.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:d6430bd0-f91e-4d64-86a8-e724885f1998"}},"homepage":"https://github.com/emdzej/csfs/tree/main/packages/opfs#readme","keywords":["filesystem","browser","zip","range-requests","opfs","file-system-access","http"],"_resolved":"/home/runner/work/csfs/csfs/dist-npm/emdzej-csfs-opfs-0.3.0.tgz","_integrity":"sha512-dHipXfdvotZ5ryhndnY68a8V5Zhml7WkiPfNHJCwzIgHFbkT5b8/IZeEFlTsSxkyFk99I2BUvmS2ODIofyEh7Q==","repository":{"url":"git+https://github.com/emdzej/csfs.git","type":"git","directory":"packages/opfs"},"_npmVersion":"11.20.0","description":"File system over the origin private file system","directories":{},"maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"@emdzej/csfs-fsa":"0.3.0","@emdzej/csfs-core":"0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.20.4"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/csfs-opfs_0.3.0_1790326444380_0.9266984088983448"}}},"time":{"created":"2026-09-04T19:10:09.881Z","modified":"2026-09-25T08:54:04.832Z","0.1.0":"2026-09-04T19:10:10.187Z","0.1.1":"2026-09-09T15:42:49.801Z","0.2.0":"2026-09-16T08:50:19.882Z","0.3.0":"2026-09-25T08:54:04.473Z"},"bugs":{"url":"https://github.com/emdzej/csfs/issues"},"license":"MIT","homepage":"https://github.com/emdzej/csfs/tree/main/packages/opfs#readme","keywords":["filesystem","browser","zip","range-requests","opfs","file-system-access","http"],"repository":{"url":"git+https://github.com/emdzej/csfs.git","type":"git","directory":"packages/opfs"},"description":"File system over the origin private file system","maintainers":[{"name":"emdzej","email":"michal@jaskolski.pro"}],"readme":"# @emdzej/csfs-opfs\n\nThe origin private file system, as a csfs file system. Private to your origin,\nwritable, and — the reason to use it — **it never prompts**.\n\n_Part of [csfs](https://github.com/emdzej/csfs) — a **c**lient **s**ide **f**ile **s**ystem: one read API over static HTTP, a picked directory,\nOPFS, and inside zip archives._\n\n```ts\nimport { opfsFileSystem, isOpfsSupported, quota } from \"@emdzej/csfs-opfs\";\n\nconst fs = await opfsFileSystem({ namespace: \"my-app\" });\nawait fs.write(\"/pr/index.dat\", bytes);\nawait fs.read(\"/pr/index.dat\"); // after a reload, with no click\n```\n\nSupported in every current browser, unlike the directory picker.\n\n## Why import into it\n\nA picked directory is the obvious way to read local data, but its permission\ndoes not survive a reload: the handle comes back, the grant does not, and\nre-requesting it needs a user gesture. So \"open the app and it just works\" is\nnot achievable that way.\n\nOPFS has no such gate. Copying a tree in once buys silent access from then on —\nwhich is the whole trade: one import, and no prompt ever again.\n\n```ts\nimport { walkFileSystem } from \"@emdzej/csfs-core\";\n\nfor await (const entry of walkFileSystem(source, \"/\")) {\n  const file = await source.file(entry.path);\n  if (file) await target.write(entry.path, await file.bytes());\n}\n```\n\n## What it costs\n\n**It is evictable.** The browser may reclaim it under storage pressure unless\nyou ask:\n\n```ts\nimport { persist } from \"@emdzej/csfs-opfs\";\nawait persist(); // true if granted\n```\n\n**It is shared across the whole origin.** Two features writing `/data` collide,\nso `namespace` puts each in its own subtree. `clearNamespace(name)` removes one\nwithout touching the others.\n\n**Check the budget before a large import.** `quota()` returns `usage` and\n`quota`; a 15 GB tree will not fit where the browser offered 2 GB, and finding\nthat out at file 40,000 is worse than finding it out at zero.\n\n**Writing through the handle API stages to a temporary file and swaps on\nclose**, so write traffic roughly doubles. Avoidable with\n`createSyncAccessHandle` inside a worker, which is the right move for a bulk\nimport.\n\n## Things engines do differently\n\n- **Case.** Chromium's and Firefox's OPFS are case-sensitive; WebKit's follows\n  its disk and folds on macOS. With `caseInsensitive`, csfs answers with the\n  stored name either way.\n- **`persist()` may prompt.** Firefox asks the user and waits, so bound it:\n  `await persist({ signal: AbortSignal.timeout(5000) })`.\n- **Private windows.** Safari's has `getDirectory` and rejects it with\n  `UnknownError`; `isOpfsSupported()` cannot tell.\n\n## Relationship to `csfs-fsa`\n\nOPFS _is_ the File System Access API, pointed at a browser-managed root, so this\npackage is a thin wrapper: `opfsFileSystem` resolves the root, applies the\nnamespace, and returns an `OpfsFileSystem` — an `FsaFileSystem` whose `kind` is\n`\"opfs\"`. A namespace may nest (`\"app/cache\"`). The extras — `persist`, `quota`,\n`clearNamespace` — are the parts that have no analogue for a picked directory;\n`clearNamespace` refuses an empty name, which would be the whole origin.\n\n## Licence\n\n**MIT** — see [LICENSE](https://github.com/emdzej/csfs/blob/main/LICENSE).\n","readmeFilename":"README.md"}