-
Notifications
You must be signed in to change notification settings - Fork 22
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
Define File's type better (getFile()) #127
Comments
Given the following code: let root = await navigator.storage.getDirectory();
let fileHandle = await root.getFileHandle('image.png', { create: true });
let file = await fileHandle.getFile();
console.log(file.type); The latest stable versions of the major browsers logs:
So we should probably either:
It seems like the latter algorithm should exist anyways in https://w3c.github.io/FileAPI/. That The Blob spec does give file type guidelines, which are supposed to apply only to "real" files on disk. In practice, it seems like these guidelines are applied to more than just "real" files, though (at least on Safari/Chrome). One option is to point the curious if others have thoughts @jesup @szewai @inexorabletash @mkruisselbrink |
FWIW it looks like drag-and-drop for files uses The only restriction seems to be that it must be ASCII lowercase, but otherwise is just refers to the (unhelpful) File spec |
The problems with |
This still logs |
FWIW, our mapping: https://source.chromium.org/chromium/chromium/src/+/main:net/base/mime_util.cc See also: w3c/FileAPI#51 Decisions about where in the processing to apply the mapping predate me, so definitely before the WebKit/Blink split. |
@a-sully that is an example using File System, against which I reported this issue. 😊 If this also exists with just the |
It seems for OPFS at least this doesn't need to be implementation-defined.
The text was updated successfully, but these errors were encountered: