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

Re: Updates to File API

From: J Ross Nicoll <jrn@jrn.me.uk>
Date: Thu, 13 May 2010 21:50:33 +0100
Cc: Web Applications Working Group WG <public-webapps@w3.org>
Message-Id: <85E17A74-547C-40F2-A9BB-D5431ED52AFA@jrn.me.uk>
To: arun@mozilla.com
On 13 May 2010, at 13:27, Arun Ranganathan wrote:

> Greetings WebApps WG,
> I have updated the editor's draft of the File API to reflect changes that have been in discussion.
> http://dev.w3.org/2006/webapi/FileAPI
> Notably:
> 1. Blobs now allow further binary data operations by exposing an ArrayBuffer property that represents the Blob.  ArrayBuffers, and affiliated "Typed Array" views of data, are specified in a working draft as a part of the WebGL work [1].  This work has been proposed to ECMA's TC-39 WG as well.  We intend to implement some of this in the Firefox 4 timeframe, and have reason to believe other browsers will as well.  I have thus cited the work as a normative reference [1].  Eventually, we ought to consider further read operations given ArrayBuffers, but for now, I believe exposing Blobs in this way is sufficient.

Why remove the 'type' attribute from the File? Specifically, is there a real issue with duplicating the information in both the File and the Blob? Two main concerns:

Without 'type' in the File attribute, you have to read the file to understand what's in it. This means that if you want to, for example, produce a confirmation dialogue for the user before reading a file, it's very limited in how much information it can show (I also think it would be a good idea to have 'size' as an attribute on the File, for related reasons).

At the moment, if a directory is been dragged and dropped into Firefox, the only way to spot this appears to be the 'type' attribute (which is empty). Unless I'm missing something, as written this would appear to mean the JS has to try reading a directory, get a Blob back (which Firefox does do, at least) and then it can find out it didn't actually read a file.

Looking at synchronized file reading... would it perhaps make more sense to have readAsBinaryString(), readAsText() and readAsDataURL() as methods on the File, rather than a specific separate interface (FileReaderSync)?
Received on Thursday, 13 May 2010 20:51:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:07 UTC