Re: File API Feedback

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, 
error)

and

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