Skip to content

Add support for web origin private file system (OPFS) - #662

Open
timo-drick wants to merge 7 commits into
vinceglb:mainfrom
timo-drick:main
Open

timo-drick wants to merge 7 commits into
vinceglb:mainfrom
timo-drick:main

Conversation

@timo-drick

Copy link
Copy Markdown
Contributor

This pull request adds support for the web origin private file system (OPFS), enabling temporary files on web targets.
The main new feature is FileKit.filesDirectory() function which will work on all platforms including web.
Unfortunately there are some things i am not really pleased with. So to be able to support PlatformFile attributes like size, lastModified ... the current web implementation loads a snapshot of a BrowserFile. It will not automatically return the newest size or lastModified values. To get them we need a suspend function interface. So i am also a little bit unsure how to cleanly add this into the architecture of FileKit. But it would be really nice if the user does not need to care which platform it is and can write most of the code in common part. So in the long run would be nice to have suspension functions for the different attributes of the file maybe for everything.

timo-drick and others added 7 commits September 14, 2026 10:33
…nc duplicates of write and delete because they where already suspend functions so they can directly supported on web.)
…port file size and last modified time. Can be updated with PlatformFile.update() to refresh metadata.
Add support for web origin private file system (OPFS)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant