W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2009

[whatwg] An BinaryArchive API for HTML5?

From: Anne van Kesteren <annevk@opera.com>
Date: Thu, 30 Jul 2009 11:41:37 +0200
Message-ID: <op.uxvjvnpf64w2qv@annevk-t60>
On Thu, 30 Jul 2009 08:49:12 +0200, Gregg Tavares <gman at google.com> wrote:
> What are people's feelings on adding a Binary Archive API to HTML5?

I think it makes more sense to build functionality like this on top of the File API rather than add more things into HTML5.


> It seems like it would be useful if there was browser API that let you
> download something like gzipped tar files.

We already have that: XMLHttpRequest.


> The API would look something like
>
> var request = createArchiveRequest();
> request.open("GET", "http://someplace.com/somearchive.tgz");
> request.onfileavailable = doSomethingWithEachFileAsItArrives;
> request.send();

I don't think we should introduce a new HTTP API.


> function doSomethingWithEachFileAsItArrives(binaryBlob) {
>   // Load every image in archive
>   if (binaryBlob.url.substr(-3) == ".jpg") {
>      var image = new Image();
>      image.src = binaryBlob.toDataURL();  // or something;
>      ...
>   }
>   // Look for a specific text file
>   else if (binaryBlog.url === "myspecial.txt") {
>     // getText only works if binaryBlob is valid utf-8 text.
>     var text = binaryBlob.getText();
>     document.getElementById("content").innerHTML = text;
>   }
> }

Having dedicated support for a subset of archiving formats in within the API for File objects makes sense to me. Latest draft of the File API I know of is

  http://dev.w3.org/2006/webapi/FileUpload/publish/FileAPI.xhtml

and the mailing list would be public-webapps at w3.org.


-- 
Anne van Kesteren
http://annevankesteren.nl/
Received on Thursday, 30 July 2009 02:41:37 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:14 UTC