Bug 254726

Summary: File System Standard: WebKit does not implement `FileSystemFileHandle.createWritable()` and `FileSystemWritableFileStream`
Product: WebKit Reporter: Thomas Steiner <tomac>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: 03_placid_daft, amanisalim, benjamin, casistaken, chrisguttandin, daxpedda, mjo2089, sihui_liu, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 231706    

Description Thomas Steiner 2023-03-29 23:53:57 PDT
The following test fails in WebKit:

- 'createWritable' in FileSystemFileHandle.prototype
- FileSystemWritableFileStream is undefined

Spec:
- https://fs.spec.whatwg.org/#api-filesystemfilehandle-createwritable
- https://fs.spec.whatwg.org/#api-filesystemwritablefilestream

I also want to report a small documentation bug: https://webkit.org/blog/12257/the-file-system-access-api-with-origin-private-file-system/#:~:text=FileSystemHandle%2C%20which%20represents%20an%20entry%20in%20the%20file%20system.%20It%20is%20available%20in%20Worker%20and lacks the word `Window`.
Comment 1 Radar WebKit Bug Importer 2023-04-05 23:54:17 PDT
<rdar://problem/107697642>
Comment 2 Alex Titarenko 2023-04-06 15:25:02 PDT
I'm really interested in this functionality to be implemented in WebKit.

I'm working on a note-taking app for the web. Currently, all user's data is stored in IndexedDb, which has a lot of limitations. I want to use instead the origin private file system to store users' notes and attachments which later will be synced with Git. For my use case, It's not really practical to use WebWorker (the only supported solution for now in WebKit) just to save notes and attachments, also it creates some overhead with transferring data between the main thread and WebWorker.

This is already supported in Chromium-based browsers and it would be great to see this in WebKit
Comment 3 amanisalim 2023-04-30 00:14:49 PDT
I also need this for my own vocabulary PWA. It has many features which I miss on every other App. I have to save serialized Jsons and read them, when I am offline.
I tried it with Chrome (Linux) and it works as expected.

The PWA works great on my iPhone and iPad when I am online, but I need it offline. Now I have to try the other method with the webworker…
Comment 4 halfmatthalfcat 2024-02-27 04:20:06 PST
Also would like to throw my support behind this - blocking current work.
Comment 5 Benjamin Golinvaux 2024-02-28 21:25:27 PST
This bug makes it really difficult to  write reliable cross-browser apps. I very interested in this fix, too. 
Thanks!
Comment 6 casistaken 2024-06-29 03:31:56 PDT
Jimmy Warting aka Endless managed to polyfill this functionality in his `native-file-system-adapter`, safari implements writes via `fileHandle.createSyncAccessHandle()` but only inside workers, so he exposed that functionality in the main thread with some magic, simply `import 'native-file-system-adapter/src/FileSystemFileHandle.js'` and you should be good to go.

More info: https://github.com/jimmywarting/native-file-system-adapter