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
667 stars 66 forks source link

Add method to access FileSystemHandle's parent directory #373

Closed scott-taylor closed 2 years ago

scott-taylor commented 2 years ago

I'm working on an application where I have a FileSystemHandle but would like to be able to read other files in the same directory as that FileSystemHandle. As far as I can tell there is no method of doing so. Even if I have to explicitly request permission from the user to access the parent directory, I can't find a method or way to do so from a FileSystemHandle.

Background: I have a PWA that gets a FileSystemHandle (using the file handling api) when a user clicks on an image from their OS. I would like to display that image to the user and allow him/her to use PgUp and PgDn to see the other media in the same directory.

If there is a better forum for these type of questions, please let me know.

a-sully commented 2 years ago

See https://github.com/WICG/file-system-access/issues/193. By design, the API does not provide information about files or directories unless access has explicitly been granted to it or one of its parent directories. If a file is selected via File Handling, the only way for the site to see other files in that directory is to select the directory via the file picker.

I would recommend showing a directory picker with the FileSystemHandle you got from File Handling as the startIn field