Skip to content

Fold File and Directory Entries API into File API - #222

Draft
jcayzac wants to merge 8 commits into
w3c:mainfrom
jcayzac:feature/entries-api
Draft

jcayzac wants to merge 8 commits into
w3c:mainfrom
jcayzac:feature/entries-api

Conversation

@jcayzac

@jcayzac jcayzac commented Jul 17, 2026 •

Copy link
Copy Markdown
Member

Incorporates the File-API-bound content from the WICG Entries API (https://wicg.github.io/entries-api/) into this specification:

  • Path and entry concepts (names, paths, files, directories, entries) and the resolve/evaluate-a-path algorithms, added to the Terminology and Algorithms section.
  • File.webkitRelativePath was merged into the File IDL.
  • New "Files and Directories" section with IDL for FileSystemEntry, FileSystemDirectoryEntry, FileSystemDirectoryReader, FileSystemFileEntry and FileSystem, along with all associated callbacks, dictionaries, algorithms, and examples.
  • Modified Web platform tests (link to pull request)
  • HTML-bound content (HTMLInputElement.webkitdirectory / webkitEntries and DataTransferItem.webkitGetAsEntry()) remains to be added to the HTML standard. See Merge "File and Directory Entries API" into HTML whatwg/html#217 (comment)
  • Technical issues are not numbered yet —if the edits are in line with what the WG wants I'll create those and add them.

Implementation commitments are "not applicable" for now since this reflects the current state of implementations.

@marcoscaceres @mkruisselbrink is this directionally correct / what you had in mind?


Preview | Diff

Comment thread index.bs Resolved
Comment thread index.bs Outdated

## Names and paths ## {#names-paths}

A <dfn export>name</dfn> is a string which:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe... just exporting "name" is too generic:

Suggested change
A <dfn export>name</dfn> is a string which:
A <dfn export local-lt="name">file name</dfn> is a [=string=] which:

@jcayzac jcayzac Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@marcoscaceres

file name would be semantically wrong, I think. This can be a directory name, a file system's name, or any entry name.

This is also related to WICG/entries-api#37

In the spirit of getting this merged first and fixing the existing issues later, I see two options for resolving this:

  1. Un-export it.
  2. Name it something more generic for now — how about entry name? It makes it less likely to be confused for File.name. Edit: there's already an entry/name too, dang. Too many names!

cc @annevk

@jcayzac jcayzac Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For now I'll just unexport it: 22c8a2c.

Comment thread index.bs Resolved
Comment thread index.bs

## Files and directories ## {#files-dirs}

A <dfn export id=file-concept>file</dfn> consists of binary data and a <dfn

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How come this one needs an id and the others don't?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

#dfn-file is already taken by the {{File}} interface (via the legacy Translate Ids mapping), so without an explicit id it collides.

Also related to WICG/entries-api#37

Comment thread index.bs Resolved
Comment thread index.bs Resolved
Comment thread index.bs
optional FilePropertyBag options = {});
readonly attribute DOMString name;
readonly attribute long long lastModified;
readonly attribute USVString webkitRelativePath;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Argh… do we really want to standardize this here? Should we send this to the WHATWG Compat spec instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@marcoscaceres That's fine by me. I was told merging as-is was higher priority than unprefixing and solving existing issues but I can start doing that now.

So this would need to be replaced with an unprefixed relativePath for the purpose of this spec, right? And to get commitment from browsers + have the old prefixed version in Compat.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think @jcayzac did the right thing.

The Compat specification is meant to be temporary. Prefixed features that end up widely deployed should just be standardized in the relevant specification, not separately.

We also don't want to introduce new features while making a big move like this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, sorry, I had this backwards then. I thought it was the other way around.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@annevk @marcoscaceres Thank you. However I think I'm still unclear on what should be the exact course of action.

"Prefixed features that end up widely deployed should just be standardized in the relevant specification" suggests I should unprefix it already since it's implemented everywhere? Or you meant standardize the prefixed version? The last sentence reads like you'd rather not unprefix now.

Sorry progress on this has been delayed a bit due to summer vacations.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Correct, we should standardize it including prefix as that is what is implemented everywhere. At a future point we can consider standardizing a separate unprefixed version. (In prior discussions that also came with some potential API refinements so it really needs to be separate from this effort.)

Comment thread index.bs Outdated
are to return [=/this=]'s [=relative path=], or the empty string if not specified.

Note: A {{File}}'s [=relative path=] is set when the {{File}} is selected as part of a
directory; see the <{input/webkitdirectory}> attribute [[HTML]].

@jcayzac jcayzac Nov 20, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@marcoscaceres @annevk until the attribute gets merged into the WHATWG spec, this is a link error. Is it OK to unlink it for now?

Suggested change
directory; see the <{input/webkitdirectory}> attribute [[HTML]].
directory; see the <code>webkitdirectory</code> attribute of the <{input}> element [[HTML]].

Incorporates the File-API-bound content from the WICG Entries API
(https://wicg.github.io/entries-api/) into this specification:

- Path and entry concepts (names, paths, files, directories, entries)
  and the resolve/evaluate-a-path algorithms, added to the Terminology
  and Algorithms section.
- File.webkitRelativePath, folded into the complete File IDL.
- New "Files and Directories" section with complete IDL for
  FileSystemEntry, FileSystemDirectoryEntry, FileSystemDirectoryReader,
  FileSystemFileEntry, and FileSystem, along with all associated
  callbacks, dictionaries, algorithms, and examples.

HTML-bound content (HTMLInputElement.webkitdirectory/webkitEntries and
DataTransferItem.webkitGetAsEntry()) is out of scope and remains to be
merged into the HTML standard.
@annevk

annevk commented Nov 23, 2026

Copy link
Copy Markdown
Member
AI feedback

Reviewed at cb152dc. I pushed 3fe0427 with fixes for problems the port introduced:

  • It restores the ECMA-262 Promise anchor. Since 7d670db, [=Promises=] has been resolving to Web Smart Card.
  • It fixes the webkitdirectory link error.
  • It drops the explicit dfn-webkitRelativePath ID, so the default dom-file-webkitrelativepath matches the WICG anchor.
  • It points the notes at [[ENTRIES-API]] rather than [[HTML]] for the members HTML doesn't define yet.
  • It restores the meaning of the upstream task source issue.

With it, Bikeshed (via the W3C spec generator) reports no warnings beyond those already on main.

I filed the problems that predate the port separately, so they don't hold up the move: #237 (relative path of a File), #238 (alignment with the File System Standard), #239 (algorithm gaps), and #240 (editorial).

Suggestions

  • The WICG draft exported none of its concepts, but the port exports most of them, and several collide with other specifications:

    Consider not exporting these for the move, as was done for name and the path terms in 307c4bf. Entries: align the file and directory model with the File System Standard #238 covers aligning with File System.

  • Once this lands, FileSystemEntry and friends are defined in two specifications. webref will flag the duplicate IDL, and WPT's interfaces/entries-api.idl will overlap with interfaces/FileAPI.idl. Consider a companion WICG/entries-api PR that removes the moved parts and points here. BCD's spec_urls will need updating too. For the tests checkbox, the existing WPT entries-api/ tests can be linked.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants