W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2012

Re: File constructor

From: Glenn Maynard <glenn@zewt.org>
Date: Fri, 11 May 2012 18:14:21 -0500
Message-ID: <CABirCh-qx6y1d=gSSsQV+-K1BcZ_6_KtN4=EtS3MPJRkFhza6g@mail.gmail.com>
To: Bronislav Klučka <Bronislav.Klucka@bauglir.com>
Cc: "public-webapps@w3.org" <public-webapps@w3.org>
On Fri, May 11, 2012 at 9:06 AM, Bronislav Klučka <
Bronislav.Klucka@bauglir.com> wrote:

> is there a reason, while File cannot be created? It is Blob with has name
> and lastModifyDate .
> http://dev.w3.org/2006/webapi/**FileAPI/#file<http://dev.w3.org/2006/webapi/FileAPI/#file>


The File/Blob distinction is a bit weak.  In some people's views, I
believe, File is for files which are actually backed by files on the user's
filesystem, but there's no actual reason to need that; it's perfectly fine
to have Blobs which are transparently backed by different mechanisms.  (I
don't think the separation has won us much; it would probably have been
fine for them to be a single class, with the few File-like attributes
nullable.)

I'm inclined to suggest that we shouldn't pretend that they're different,
and give File a ctor like Blob's.  (In principle we could have only a File
ctor, since a File with an empty filename and null lastModifiedDate works
anywhere a Blob does...)


On Fri, May 11, 2012 at 1:20 PM, Bronislav Klučka <
Bronislav.Klucka@bauglir.com> wrote:

>  Going through the ideas there, we could amend Jonas'es idea ad consider
> something like
>
> var file = blob.getFile(DOMString filename, optional DomString
> contentType);
>
> to actually get a File object (since we are moving away from BlobBuilder)
>

The modern equivalent of his BlobBuilder-based suggestion is to add a File
ctor, not to add a method to Blob.

-- 
Glenn Maynard
Received on Friday, 11 May 2012 23:14:51 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:52 GMT