- From: Michael Nordman <michaeln@google.com>
- Date: Tue, 21 Jul 2009 18:28:32 -0700
- To: arun@mozilla.com
- Cc: public-webapps@w3.org
- Message-ID: <fa2eab050907211828k8d8ab84l201bb70ddff307a3@mail.gmail.com>
On Tue, Jul 21, 2009 at 6:20 PM, Arun Ranganathan <arun@mozilla.com> wrote: > 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. I don't follow... how would you use the FileData and XHR2 apis to do what I outlined with blob builder... can you show me in a similar amount of pseudo code? > > > 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 Thursday, 23 July 2009 05:50:53 UTC