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

Feedback: It should be possible to request readwrite access before getting read access. #302

Closed tormodAase closed 3 years ago

tormodAase commented 3 years ago

There's no way to send only one permission request if you need write access. That is annoying. There should be a way to define which permissions you need in the showDirectoryPicker/showFilePicker methods, reducing permission requests by 50% (from 2 to 1) when you need write access.

Example:

This code sends two requests to the user. First a read permission request, followed by a write permission request.

window.showDirectoryPicker().then(handle => {
  handle.requestPermission({mode:'readwrite'})
})

If there were some way to define which permissions you need in the showDirectoryPicker method, we could reduce the # of requests to 1:

window.showDirectoryPicker({mode:'readwrite'}).then(handle => {
  //some code
})
a-sully commented 3 years ago

Duplicate of #89

This is in the works, though! See #300

tomayac commented 2 months ago

While a mode option was added to showDirectoryPicker(), it's not possible to do the same with showOpenFilePicker(), which the original post mentioned, but the Issue was then merged with #89, which only looked at the showDirectoryPicker() part.

This came up now again in the context of the Intent to Ship for Android.

CC: @joelhockey