Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
zip utility implemented with JavaScript
JavaScript CoffeeScript CSS

This branch is 5 commits ahead, 338 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
build
example
lib
src
test
.gitmodules
LICENSE
README.md

README.md

jsziptools

It's a utility of zlib, gzip and zip format binary data.

required

required ffDataview(http://github.com/ukyo/ffDataView).

zlib

decompress compressed swf file:

var swf = jz.utils.loadFileBuffer('compressed.swf');
var header = new Uint8Array(swf, 0, 8);
var decompressedData = jz.zlib.decompress(new Uint8Array(swf, 8));

gzip

compress and download:

var text = 'aaaaaabbbbbbbbbbbccccccccc';
var gzbuff = jz.gz.compress(jz.utils.stringToArrayBuffer(text));
var BlobBuilder = window.MozBlobBuilder || window.WebKitBlobBuilder;
var URL = window.URL || window.webkitURL;
var bb = new BlobBuilder();
bb.append(gzbuff);
location.href = URL.createObjectURL(bb.getBlob());
//rename a download file.

zip

zip:

var buffer = jz.zip.compress([
  {name: "foo", childern: [ //folder
    {name: "hello.txt", str: "Hello World!"}, //string
    {name: "bar.js", url: "../src/bar.js"} //xhr
  ]}
]);

//個別に圧縮レベルを設定する場合
var buffer = jz.zip.compress([
  {name: "foo", childern: [ //folder
    {name: "hello.txt", str: "Hello World!", level: 3}, //string
    {name: "bar.js", url: "../src/bar.js", level: 9} //xhr
  ]}
]);

unzip:

//if arg is string, load with xhr.
var loader = jz.zip.decompress("foo.zip");
//get file pathes.
loader.getFileNames();
//file is read lazy.
loader.getFileAsText(loader.getFileNames[0], function(result){
  alert(result);
});

support chrome, firefox, IE10.

Something went wrong with that request. Please try again.