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