Skip to content

File and directory entries API #2993

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

File and directory entries API #2993

wants to merge 2 commits into from

Conversation

captainbrosset
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the feature definition Creating or defining new features or groups of features. label May 22, 2025
@ddbeck
Copy link
Collaborator

ddbeck commented May 26, 2025

@captainbrosset do you have any commentary on the existing #2633 PR? In that one (and some linked BCD discussions) it seems like there are some real issues with the way the API is exposed in Chromium.

@captainbrosset
Copy link
Contributor Author

captainbrosset commented May 26, 2025

@captainbrosset do you have any commentary on the existing #2633 PR? In that one (and some linked BCD discussions) it seems like there are some real issues with the way the API is exposed in Chromium.

@ddbeck sorry, I had not seen that other PR before opening mine. Sorry about the duplicated work.

Looks like the interface names are indeed different in Chromium: dropping files on an <input type=file> leads to FileEntry objects in Chromium, whereas it creates FileSystemFileEntry objects in Firefox (I have not tested in Safari).

The spec disagrees with Chromium: https://wicg.github.io/entries-api/#api-fileentry but the Chromium names seem very old: https://groups.google.com/a/chromium.org/g/blink-dev/c/_6Euwqv366U and WICG/entries-api#6.

The impression I'm getting is that this API is not in a great state of standardization and interoperability, and there has been little energy to fix this over the years.

On our end, I think we ought to have a feature in the repo for it anyway. And use whatever BCD keys are at our disposal at the moment. The reason is, whatever the interface name differences, one can still write code that works on both Chromium and Firefox:

<!DOCTYPE html>

<label for="file-input">Drop files on the input</label>
<input type="file" id="file-input" multiple>

<script>
  const inputEl = document.getElementById('file-input');
  inputEl.addEventListener('change', function(event) {
    const entries = inputEl.webkitEntries;
    console.log(entries);
  });
</script>

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.

2 participants