jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.06k stars 216 forks source link

Support for createSyncAccessHandle in FileSystemAccess.ts #360

Closed AntonOfTheWoods closed 11 months ago

AntonOfTheWoods commented 11 months ago

Safari doesn't support createWritable but now all major browsers support FileSystemSyncAccessHandle, at least in webworkers. It would be great to have this, as the sync filehandles are blazingly fast and allow for some great usecases (like sqlite in the browser, etc.).

james-pre commented 11 months ago

@AntonOfTheWood

This class is only accessible inside dedicated Web Workers (so that its methods do not block execution on the main thread) for files within the origin private file system, which is not visible to end-users.

While I like the idea, this will not work since it is not supported on the main thread.

AntonOfTheWoods commented 11 months ago

Upon further investigation, I found the undocumented registerFileSystem. Inheriting and overriding a couple of methods on FileSystemAccess with their sync variants should not be a difficult task. Would you be open to a spot of documentation on how to use your own Backend (after I figure it out of course!)?

james-pre commented 11 months ago

Sure! Please follow #200 for how that is going. I will work on it after CI/CD is up and running.