资源说明:zip utility implemented with JavaScript
# jsziptools It's a utility of zlib, gzip and zip format binary data. ## suported browser chrome, firefox, Edge, safari, opera. ## examples ### web examples * [Deflate text](http://ukyo.github.com/jsziptools/examples/deflate_text.html) * [Zip viewer](http://ukyo.github.com/jsziptools/examples/zip_viewer.html) ## APIs ### common #### BufferLike @type {string | number[] | ArrayBuffer | Uint8Array | Int8Array | Uint8ClampedArray} #### jz.common.toBytes(buffer) * @param {BufferLike} buffer * @return {Uint8Array} #### jz.common.readFileAsArrayBuffer(blob) * @param {Blob} blob * @return {Promise\} ```js jz.common.readFileAsArrayBuffer(blob).then(buffer => { // ... }); ``` #### jz.common.readFileAsText(blob, encoding) * @param {Blob} blob * @param {string} encoding - optional (default is `"UTF-8"`) * @return {Promise\ } #### jz.common.readFileAsDataURL(blob) * @param {Blob} blob * @return {Promise\ } #### jz.common.bytesToString(buffer) * @param {BufferLike} buffer * @return {Promise\ } ```js jz.common.bytesToString(bytes).then(str => { // ... }); ``` #### jz.common.concatBytes(buffers) * @param {Array\ } buffers * @return {Uint8Array} ```js let concated = jz.common.concatBytes([bytes1, bytes2]); // or let concated = jz.common.concatBytes(bytes1, bytes2); ``` #### jz.common.load(urls) It loads files as `Uint8Array`. * @param {Array\ } urls * @return {Promise\ } ```js jz.common.load(['foo.png', 'bar.jpg']).then(([foo, bar]) => { // ... }); // or jz.common.load('foo.png', 'bar.jpg').then(([foo, bar]) => { // ... }); ``` ### core #### jz.core.deflate({buffer, level, chunkSize}) * @param {BufferLike} buffer * @param {number} level - optional (default is `6`, range is 0-9) * @param {number} chunkSize - optional (default is `0x8000`) * @return {Uint8Array} #### jz.core.inflate({buffer, chunkSize}) * @param {BufferLike} buffer * @param {number} chunkSize - optional (default is `0x8000`) * @return {Uint8Array} #### jz.core.adler32(buffer) * @param {BufferLike} buffer * @return {number} #### jz.core.crc32({buffer, crc}) * @param {BufferLike} buffer * @param {number} * @return {number} #### jz.stream.core.deflate({buffer, streamFn, level, shareMemory, chunkSize}) * @param {BufferLike} buffer * @param {function(chunk: Uint8Array)} streamFn * @param {number} level - optional (default is `6`) * @param {boolean} shareMemory - optional (default is `false`) * @param {number} chunkSize - optional (default is `0x8000`) ```js jz.stream.core.deflate({ buffer: buffer, streamFn: chunk => { // ... }, shareMemory: false, }); ``` #### jz.steram.core.inflate({buffer, streamFn, shareMemory, chunkSize}) * @param {BufferLike} buffer * @param {function(chunk: Uint8Array)} streamFn * @param {boolean} shareMemory - optional (default is `false`) * @param {number} chunkSize - optional (default is `0x8000`) ### zlib #### jz.zlib.compress({buffer, level, chunkSize}) * @param {BufferLike} buffer * @param {number} level - optional (default is `6`) * @param {number} chunkSize - optional (default is `0x8000`) * @return {Uint8Array} #### jz.zlib.decompress({buffer, chunkSize}) * @param {BufferLike} buffer * @param {number} chunkSize - optional (default is `0x8000`) * @return {Uint8Array} #### jz.stream.zlib.compress({buffer, streamFn, level, shareMemory, chunkSize}) * @param {BufferLike} buffer * @param {function(chunk: Uint8Array)} streamFn * @param {number} level - optional (default is `6`) * @param {boolean} shareMemory - optional (default is `false`) * @param {number} chunkSize - optional (default is `0x8000`) #### jz.stream.zlib.decompress({buffer, streamFn, shareMemory, chunkSize}) * @param {BufferLike} buffer * @param {function(chunk: Uint8Array)} streamFn * @param {boolean} shareMemory - optional (default is `false`) * @param {number} chunkSize - optional (default is `0x8000`) ### gzip #### jz.gz.compress({buffer, level, chunkSize}) * @param {BufferLike} buffer * @param {number} level - optional (default is `6`) * @param {number} chunkSize - optional (default is `0x8000`) * @return {Uint8Array} #### jz.gz.decompress({buffer, chunkSize}) * @param {BufferLike} buffer * @param {number} chunkSize - optional (default is `0x8000`) * @return {Uint8Array} #### jz.stream.gz.compress({buffer, streamFn, level, shareMemory, chunkSize, fname, fcomment}) * @param {BufferLike} buffer * @param {function(chunk: Uint8Array)} streamFn * @param {number} level - optional (default is `6`) * @param {boolean} shareMemory - optional (default is `false`) * @param {number} chunkSize - optional (default is `0x8000`) * @param {string} fname - optional * @param {string} fcomment - optional #### jz.stream.gz.decompress({buffer, streamFn, shareMemory, chunkSize}) * @param {BufferLike} buffer * @param {function(chunk: Uint8Array)} streamFn * @param {boolean} shareMemory - optional (default is `false`) * @param {number} chunkSize - optional (default is `0x8000`) ### zip #### jz.zip.pack({files, level, chunkSize}) * @param {Array.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。