- From: Charles Pritchard <chuck@jumis.com>
- Date: Sun, 30 Oct 2011 10:54:12 -0700
- 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 projects. 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. -Charles
Received on Sunday, 30 October 2011 17:54:37 UTC