Replies: 1 comment 8 replies
|
Hey @kachurun, thanks for suggesting the idea. ZenFS actually does have a backend for OPFS: |
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi @james-pre!
I’ve been working on a project that needs persistent file storage in the browser, so I chose OPFS. I couldn’t find a backend for zen-fs, so I built a workaround — but quickly ran into Safari issues like createWritable missing, structuredClone problems with FileHandle, and others. That’s basically the blocker: every library that tries to use OPFS runs into the same Safari issues, making it impossible to use in production.
That led me to create opfs-worker - OPFS adapter based on web workers. It runs createSyncHandle inside a dedicated worker (bundled as a data URI so no static files are needed) and exposes low-level FS ops (open, read, write, close, fstat, mkdir, etc.) to the main thread.
I’m also planning to use it to fix the same issues in browser-only Theia IDE. Since that PR isn’t merged yet, I still have flexibility to adjust or even rewrite the adapter’s internals.
Now I’m wondering if it would make sense to contribute this as a zen-fs backend that wraps opfs-worker. That way, zen-fs would gain proper OPFS support (including Safari), and I could simplify my library by dropping the extra facade layer I currently maintain.
What do you think about it?
All reactions