I wanted to share a library I wrote that I think is needed to make OPFS actually useful.
For context, OPFS is the Origin Private File System, giving your app a orgin-scoped high performance file system, ideal for stuff like sqlite or data intensive local-first apps.
However, if you have multiple windows or tabs, using the same FileHandle will break your app, since there can only be one FileHandle per file.
This library attempts to fix this by doing some MessagePort acrobatics between tabs, and keeps only one worker alive managing access to the file system.
ch_sm•1h ago
I wanted to share a library I wrote that I think is needed to make OPFS actually useful.
For context, OPFS is the Origin Private File System, giving your app a orgin-scoped high performance file system, ideal for stuff like sqlite or data intensive local-first apps.
However, if you have multiple windows or tabs, using the same FileHandle will break your app, since there can only be one FileHandle per file.
This library attempts to fix this by doing some MessagePort acrobatics between tabs, and keeps only one worker alive managing access to the file system.
It’s informed by this discussion on wa-sqlite: https://github.com/rhashimoto/wa-sqlite/discussions/81
Hope somebody will find this useful!