W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2011

Re: Enable compression of a blob to .zip file

From: Charles Pritchard <chuck@jumis.com>
Date: Sun, 30 Oct 2011 10:54:12 -0700
Message-ID: <4EAD8F44.9080108@jumis.com>
To: Alfonso Martínez de Lizarrondo <amla70@gmail.com>
CC: Webapps WG <public-webapps@w3.org>
On 10/30/11 3:03 AM, Alfonso Martínez de Lizarrondo wrote:
> Instead of a method on a Blob, it could be a separate object similar 
> to Mozilla nsIZipWriter 
> (https://developer.mozilla.org/en/nsIZipWriter), but with some 
> simplifications to avoid extra verbose code.
> var zipWriter = new zipWriter( 'compressed.zip' );
> // This way it could be possible to add several files into the zip
> zipWriter.addEntryFile( file);
> formData.append( zipWriter );
> etc...
> Of course, in the files should be always added at the root of the zip 
> without any info about the original path. The compression can (and 
> probably should) be done asynchronously.
> Would it be possible to add this new feature to some spec?

I've repeatedly come across the need to have inflate support. There are 
a handful of libraries on the net implementing inflate / deflate. 
Licensing on them is spotty.

One reason I've needed inflate is for svgz support. Browser vendors have 
consistently left bugs and/or ignored the spec for handling svgz files. 
SVG is really intended to be deflated.

If we had basic inflate/deflate, it'd be trivial to support .zip, .docx 
and various other zip derivatives. As authors, we could also decide when 
to compress Blobs prior to storage.

I give a big +1 to inflate/deflate. I'd also like support for base64 
encoding and decoding of binary strings. Currently, base64 encoding is 
for DOMString and non-utf8 characters will lead to the browser throwing 
an error. There are work-arounds, such as using FileReader and Blob, 
they are indirect, practically obfuscated.

I've been using a "BlobString" method to handle most of this work in my 
It'd be great to have a spec to follow, so I can just use them as polyfill.

These items don't require much for browser vendors. They already have 
support for inflate/deflate and base64 encoding. The issue, the work, is 
all about writing up a spec.

Received on Sunday, 30 October 2011 17:54:37 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:36 UTC