Re: [XHR2] Blobs, names and FormData

2011/7/18 Adrian Bateman <adrianba@microsoft.com>:
> On Monday, July 11, 2011 12:46 PM, Charles Pritchard wrote:
>> Problem is too strong a statement. I am all for trivial changes, part of my
>> advocacy for getFile is from past experiences when blob was less supported;
>> getFile would have helped.
>>
>> FileReader has base64 encoding for binary data-- base64 encoding otherwise
>> only works on DOMString.
>>
>> I'd like to see both proposals implemented... Then I get everything!
>> On Jul 11, 2011, at 12:21 PM, Adrian Bateman <adrianba@microsoft.com> wrote:
>> > It requires more work for us. Our createObjectURL doesn't require that abstraction.
>> > The difference here is in the ECMAScript type. In contrast, modifying FormData
>> > append is a trivial change.
>> >
>> > What are the other APIs where this is a problem?
>
> Our view is to see everything here as a Blob. A File is a specialisation of Blob that
> happens to have a name and modified date.

I agree with this. Precisely for this reason it should be as easy for
implementations to create File objects as Blob objects. If it isn't in
your implementation this seems like an implementation problem and not
something inherent in the specifications.

If you do think it means that it prevents you from performing certain
optimizations, then I'd be very curious to hear what those
optimizations are.

> If there is an API that replies on File to
> work correctly we think we should fix it to work with Blob. For example, FileReader is
> really BlobReader and works fine with Blobs. To me, getFile() should be unnecessary and
> the best fix for FormData is to just modify append for this situation.

While File and Blob are indeed very similar, they are also not the
same thing. I think being able to create files is an easy addition for
implementations, while it means not restricting getting Files from the
users file system. So if you have code that expects to read a File
from IndexedDB, the page can either populate that from the users
filesystem, or by generating the data manually and using
BlobBuilder.getFile.

/ Jonas

Received on Monday, 18 July 2011 21:44:02 UTC