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

Use of File in ShareData #181

Closed
plinss opened this issue Sep 23, 2020 · 9 comments
Closed

Use of File in ShareData #181

plinss opened this issue Sep 23, 2020 · 9 comments
Labels
tag-needs-resolution Issue the Technical Architecture Group has raised and looks for a response on.

Comments

@plinss
Copy link
Member

plinss commented Sep 23, 2020

From the TAG review:

There are other sources of data that users may want to share that aren't necessarily Files, e.g. a Blob taken directly from a media API. We recommend that File is replaced with Blob in ShareData (and possibly rename the dictionary member).

@mkruisselbrink
Copy link

Not saying that it wouldn't make sense to support any Blob rather than just File objects, but a File object is really nothing more than a Blob with a name, and a website can easily turn any Blob into a File object (i.e. new File([myblob], 'file name')), so I'm not sure how limiting the API this to File objects limits this to what data can be shared.

@plinss
Copy link
Member Author

plinss commented Sep 23, 2020

What's the file name of a Blob pulled from a camera? Why should the web app have to do this extra step? If the API accepts a Blob the web page can send a File as well, the browser is free to check for the presence of the name attribute and use it, but shouldn't require it.

If the underlying OS API requires a file name, the UA can synthesize one rather than putting the burden on the web developer, which would also produce inconsistent results.

@plinss plinss added the tag-needs-resolution Issue the Technical Architecture Group has raised and looks for a response on. label Sep 23, 2020
@ewilligers
Copy link
Collaborator

Changing files to be a sequence of blobs seems reasonable and trivial, if an implementation can easily determine that a blob is actually a file.

@marcoscaceres
Copy link
Member

We could make it typedef (Blob or File) ShareableObject;... best of both worlds :)

@saschanaz
Copy link
Member

saschanaz commented Sep 29, 2020

File is a sub-interface of Blob so no need for a union.

@marcoscaceres
Copy link
Member

Oh yes, good point @saschanaz. However, would we lose the File class's attributes (e.g., filename) by casting it to blob via the IDL layer? 🤔 Would we use an overload instead?

@marcoscaceres
Copy link
Member

Actually, ignore the overload question there... we probably want something that can handle: {files: [blob, file, blob, file] }

@marcoscaceres
Copy link
Member

On reflection, it's just as easy and probably better just to convert a blob into a file via the constructor. Closing.

@marcoscaceres
Copy link
Member

marcoscaceres commented Aug 1, 2022

Sent request to TAG to close issue on their tracker https://lists.w3.org/Archives/Public/www-tag/2022Aug/0000.html

@plinss plinss removed the tag-needs-resolution Issue the Technical Architecture Group has raised and looks for a response on. label Aug 15, 2022
@w3cbot w3cbot added the tag-needs-resolution Issue the Technical Architecture Group has raised and looks for a response on. label Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag-needs-resolution Issue the Technical Architecture Group has raised and looks for a response on.
Projects
None yet
Development

No branches or pull requests

6 participants