W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: File API Feedback

From: Arun Ranganathan <arun@mozilla.com>
Date: Tue, 21 Jul 2009 18:20:06 -0700
Message-ID: <4A666946.2050204@mozilla.com>
To: Michael Nordman <michaeln@google.com>, public-webapps@w3.org
Michael Nordman wrote:
> The BlobBuilder.append() method is central to the use-case I'm referring to.
> builder.append(string data that comprises the multipart/form-data header);
> builder.append(string data that comprises simple text part);
> builder.append(string data that comprises the start of a binary part);
> builder.append(fileBlob); // the file itself
> builder.append(string data that closes the binary part);
> // perhaps more binary and text parts
> builder.append(string data that closes the multipart/form-data);
> multipartBlob = builder.getAsBlob();
OK, I understand your use case much better now :)

So, currently, we provide a fileData.getAsText(fileCallback, encoding, 


within fileCallback (a callback function) you can get the file's data as 
a string (say a UTF-8 encoded string, or any encoding specified by 
"encoding"); it is passed as an argument to fileCallback.

Then, you can append to the string (or prepend, in the case of the 
header) using the standard JavaScript string methods.  And you can, of 
course, post the string via XHR.

Along with a similarly asynchronous splice method to generate "ranged" 
subsets of a FileData object, I think that we've got *most* of the 
features exposed by both BlobBuilder and Blob.

Have I missed something important?
> Splice doesn't come into play for the use case described above. The
> motivation for the .splice method is to "chunk" very large files into many
> parts, and to upload them individually... think large YouTube videos
Understood.  That is why I am adding it to the specification :-)

-- A*
Received on Wednesday, 22 July 2009 01:20:48 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:17 UTC