UNPKG

jszip

Version:

Create, read and edit .zip files with Javascript http://stuartk.com/jszip

18 lines (15 loc) 699 B
'use strict'; var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined'); var ZlibDeflate = require('zlibjs/bin/rawdeflate.min').Zlib; var ZlibInflate = require('zlibjs/bin/rawinflate.min').Zlib; exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array"; exports.magic = "\x08\x00"; exports.compress = function(input) { var deflate = new ZlibDeflate.RawDeflate(input); return deflate.compress(); }; exports.uncompress = function(input) { var inflate = new ZlibInflate.RawInflate(input); return inflate.decompress(); };