WICG / file-system-access

Expose the file system on the user’s device, so Web apps can interoperate with the user’s native applications.
https://wicg.github.io/file-system-access/
Other
669 stars 66 forks source link

Safari iOS OPFS Unknown Error: invalid platform file handle #412

Closed mshaw-siouxsteel closed 1 year ago

mshaw-siouxsteel commented 1 year ago

I'm new to the github community so I apologize in advance if I make any faux pas.

I'm currently trying to develop for an iPad (iOS 15.7.3) as I have an app that needs to record up to 360 images, which if stored in RAM will crash the iPad. So, I've made a solution that uses OPFS to hand-off the files until they need to be uploaded. I've gotten it to the point where I'm testing on Safari on my test iPad (iOS 16.3.1) but I'm getting an error that seems to be coming from the File System Access API that has no documentation anywhere, as far as multiple days of searching have found anyhow.

Unhandled Promise Rejection: UnknownError: invalid platform file handle

Here are the lines it points to:

const root = await navigator.storage.getDirectory();
const saveHandle = await root.getFileHandle(input.fileName, { create: true });
const access = await saveHandle.createSyncAccessHandle(); //<-- ERROR

input.fileName is usually something like S0I0.txt but I've tried with various other names and it doesn't seem to matter what I call the file.

From everything I've gathered, this appears to be an incompatibility issue, but from what I've read the OPFS portion should be usable on any iOS version since 15.2.

If more data is needed, I have some on this Stack Overflow Question.

Am I misunderstanding what exactly constitutes the OPFS portion of FSA API? What specifically does this error mean? Is this error even coming from the FSA API?

tomayac commented 1 year ago

Responded on StackOverflow. TL;dr: this was a WebKit bug apparently.

jimmywarting commented 1 year ago

yea... this question really dose not belong here. it's more of a Stackoverflow question or safari/webkit bug. it's really much unfinish. it's not useable at all at this moment so they shouldn't have added it.

here is a list of things that works and dose not work in safari. https://jimmywarting.github.io/native-file-system-adapter/example/test.html

might want to try out my polyfill for it: https://github.com/jimmywarting/native-file-system-adapter/