flate.js 602 B

12345678910111213141516
  1. 'use strict';
  2. var USE_TYPEDARRAY = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Uint32Array !== 'undefined');
  3. var pako = require("pako");
  4. exports.uncompressInputType = USE_TYPEDARRAY ? "uint8array" : "array";
  5. exports.compressInputType = USE_TYPEDARRAY ? "uint8array" : "array";
  6. exports.magic = "\x08\x00";
  7. exports.compress = function(input, compressionOptions) {
  8. return pako.deflateRaw(input, {
  9. level : compressionOptions.level || -1 // default compression
  10. });
  11. };
  12. exports.uncompress = function(input) {
  13. return pako.inflateRaw(input);
  14. };