Re: File API Feedback

On Tue, Jun 30, 2009 at 2:25 PM, Olli Pettay wrote:
> On 6/30/09 1:44 PM, Ian Hickson wrote:
>>
>> I'd rather just have an API that lets you split a File into a
>> sequence<FileData>  (where FileData is what File inherits from) of equally
>> sized chunks, or something like that, than something that lets you get
>> chunks out in particular forms.
>
> Yeah, that sounds better. Then XHR .send() could accept FileData as a
> parameter.
> All the .getAsXXX methods would move to that interface and there should be
> something like
> FileData getFileData(long long offset, long long length)

For the record, Gears' Blob (the almost-equivalent of that FileData if
I'm not mistaken) has a slice(offset,length) method:
http://code.google.com/apis/gears/api_blob.html

(and a Blob can be passed to an HttpRequest's send() method, and
obtained from an HttpRequest's responseBlob property or in desktop's
openFiles callback; note that a File in Gears doesn't inherit Blob, it
rather has a 'blob' property of type Blob)

-- 
Thomas Broyer

Received on Tuesday, 30 June 2009 13:07:54 UTC