Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File system access API #1713

Merged
merged 4 commits into from
Sep 3, 2024
Merged

File system access API #1713

merged 4 commits into from
Sep 3, 2024

Conversation

captainbrosset
Copy link
Contributor

Adding a new entry for the File System Access API.

Spec: https://wicg.github.io/file-system-access/
Blog: https://developer.chrome.com/docs/capabilities/web-apis/file-system-access
MDN: https://developer.mozilla.org/en-US/docs/Web/API/File_System_API

Taking this opportunity to create a group to bundle this with OPFS.

Pinging @tomayac to take a look at the description I wrote and at the browser compat data, to double check that they seem correct.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label Aug 30, 2024
Copy link

@tomayac tomayac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! Left a comment with a suggestion.

features/file-system-access.yml Outdated Show resolved Hide resolved
features/file-system-access.yml Outdated Show resolved Hide resolved
caniuse: native-filesystem-api
group: file-system
compat_features:
- api.DataTransferItem.getAsFileSystemHandle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be part of a distinct thing, like https://caniuse.com/dragndrop. What do we lose by leaving it out of this feature?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's part of file system access, albeit of course it's also part of drag and drop. FWIW, we document it in the context of file system access at Google:

Copy link
Collaborator

@ddbeck ddbeck Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK @captainbrosset can you add a comment to this file saying something like the following?

api.DataTransferItem.getAsFileSystemHandle is likely to be part of a drag and drop feature, but it can't be in both features at once. See https://github.com/web-platform-dx/web-features/issues/1173 for details

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving it out doesn't change the overall feature support data.

It's worth thinking about why it's here though. This method is an extension to the dragndrop feature which allows you to turn a dropped file/directory into a FileSystemHandle, which then allows you to write to it, just like if you had opened it using showOpenFilePicker instead.

Overall, I can think of 4 different ways to get access to a FileSystemHandle, and using one of the show picker methods is just one of them:

  • Using showOpenFilePicker or showDirectoryPicker.
  • Dropping the file on the browser window, and using getAsFileSystemHandle.
  • Registering the app as a file handler, via the web app manifest, and using window.launchQueue.setConsumer() to retrieve the file when the installed PWA is launched after double-clicking an associated file.
  • Retrieving the handle from IndexedDB storage.

I think this feature should not only cover the show methods, but also contain the various methods/interfaces that let you play with FileSystemHandle objects in code.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDB requires having gone through either D&D or the picker methods. File handling could be an independent feature (OS integration), but I can also agree to it being part of overall file system.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not objecting to its inclusion here. I just really want the https://github.com/web-platform-dx/web-features/issues/1173 text in the YAML file somewhere, because I think these file APIs are going to be rather central to figuring out BCD keys shared across multiple features. When it comes time to tackle that problem, I want breadcrumbs to the places where that's significant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I'll add a comment about this in here.
@tomayac I agree that File Handling should be its own separate feature.

Co-authored-by: Daniel D. Beck <daniel@ddbeck.com>
caniuse: native-filesystem-api
group: file-system
compat_features:
- api.DataTransferItem.getAsFileSystemHandle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not objecting to its inclusion here. I just really want the https://github.com/web-platform-dx/web-features/issues/1173 text in the YAML file somewhere, because I think these file APIs are going to be rather central to figuring out BCD keys shared across multiple features. When it comes time to tackle that problem, I want breadcrumbs to the places where that's significant.

@ddbeck ddbeck merged commit 918adf1 into main Sep 3, 2024
3 checks passed
@ddbeck ddbeck deleted the fsa branch September 3, 2024 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature definition Creating or defining new features or groups of features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants