Re: New FileAPI Draft | was Re: FileAPI feedback

On Thu, 06 Aug 2009 01:10:31 +0200, Gregg Tavares <gman@google.com> wrote:
> Why make a new API for getting the contents of a file (local or  
> otherwise) when we already have one which is XHR?

XHR does not do local data. It also does not do raw file data very well.


> What if FileList was just array of File objects where each File object is
> just a URL in the format
>
> "filedata: uuid, filename"
>
> Then you can use that URL anywhere in HTML a URL is valid. script, img,
> audio, video, css, AND XHR

I agree that we need this functionality:

   http://lists.w3.org/Archives/Public/public-webapps/2009JulSep/thread.html#msg67

I'm not sure if feeding it to XHR makes sense though. Especially if you  
just want to do a partial read there would be quite a bit of overhead.


> That would mean you wouldn't be adding a new API to get the contents of a
> file. If you want the contents just use XHR and use the URL from the  
> File in the FileList.
>
> You could add a few more functions to XHR like request.getAsDataURL(),
> request.getAsTextInEncodiing(), etc. if need be if they are needed

It's an interesting idea, but overloading XMLHTtpRequest in this way does  
not seem like a good idea to me.


-- 
Anne van Kesteren
http://annevankesteren.nl/

Received on Thursday, 6 August 2009 07:49:43 UTC