Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions features/draft/spec/file-system-access.yml

This file was deleted.

13 changes: 13 additions & 0 deletions features/file-system-access.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: File system access
description: The `showOpenFilePicker()`, `showDirectoryPicker()`, and `showSaveFilePicker()` methods request access to files and directories on the user's device and returns a handle for reading and writing to them.
spec: https://wicg.github.io/file-system-access/
caniuse: native-filesystem-api
group: file-system
compat_features:
# 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
- 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.

- api.FileSystemHandle.queryPermission
- api.FileSystemHandle.requestPermission
- api.Window.showDirectoryPicker
- api.Window.showOpenFilePicker
- api.Window.showSaveFilePicker
1 change: 1 addition & 0 deletions features/origin-private-file-system.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Origin private file system
description: The `navigator.storage.getDirectory()` method returns a `FileSystemDirectoryHandle` that is restricted to a specific origin and invisible to the user's actual file system for faster file-based applications, such as SQLite databases.
spec: https://fs.spec.whatwg.org/#origin-private-file-system
group: file-system
1 change: 1 addition & 0 deletions groups/file-system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
name: File system access