Hi Franz,

blobs can only be constructed out of utf-8 strings or binary data
(integers), while you are assuming that BlobBuilder is "smart" and
will understand base64. It won't. You should convert your base64-
encoded zip file into an array of integers and feed them, one by one,
to BlobBuilder (or as an array - see BlobBuilder API). This works
reasonably fast in Gears plugin but is terribly slow in Chrome for
large files (100k+).

MG

On Nov 10, 2:33 pm, gear-newbie <[email protected]> wrote:
> Today I stumpled upon JSZip (http://jszip.stuartk.co.uk/), a very
> interesting  library, that allows the creation of zip archives with
> Javascript. The zip archive is dumped out as base64 encoded string,
> but thanks to Gears' blobBuilder/ResourceStore it can be served from a
> "real" url.
>
> This offers some interesting possibilities: you could include data
> backup/export facilities in your gears app (e.g. download your wiki
> pages as zip) without bothering your server.
>
> I have been playing around a bit with this, but i failed to serve a
> valid zip file via gears (when i serve jszip's output via dataurl,
> everything is fine, but this raises other cross-browser difficulties
> and is not an option).
>
> var blobBuilder = google.gears.factory.create('beta.blobbuilder');
> var zip = new JSZip()
> zip.add("Hello.txt", "Hello World\n");
> var content = zip.generate();
> blobBuilder.append('Content-Transfer-Encoding: base64\r\n');
> MyResourceStore.captureBlob(content,'dummy.zip','application\zip'); //
> MyResourceStore was previously instantiated
>
> I suppose that I need to adapt the http headers and/or the transfer
> encoding. any suggestions?
>
> Franz

Reply via email to