Browser files rebuild

master
Vitaly Puzrin 2015-06-09 22:56:43 +03:00
rodzic e77b84ea95
commit 54a8b34cd9
6 zmienionych plików z 185 dodań i 105 usunięć

120
dist/pako.js vendored
Wyświetl plik

@ -1,4 +1,4 @@
/* pako 0.2.6 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* pako 0.2.7 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
@ -18,6 +18,7 @@ var Z_FINISH = 4;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_SYNC_FLUSH = 2;
var Z_DEFAULT_COMPRESSION = -1;
@ -47,7 +48,9 @@ var Z_DEFLATED = 8;
*
* Compressed result, generated by default [[Deflate#onData]]
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Deflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -171,8 +174,9 @@ var Deflate = function(options) {
*
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
* new compressed chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Deflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the compression context.
*
* On fail call [[Deflate#onEnd]] with error code and return false.
*
@ -225,7 +229,7 @@ Deflate.prototype.push = function(data, mode) {
this.ended = true;
return false;
}
if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
} else {
@ -242,6 +246,13 @@ Deflate.prototype.push = function(data, mode) {
return status === Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === Z_SYNC_FLUSH) {
this.onEnd(Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -265,8 +276,9 @@ Deflate.prototype.onData = function(chunk) {
* - status (Number): deflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell deflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called once after you tell deflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Deflate.prototype.onEnd = function(status) {
@ -363,6 +375,7 @@ exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
},{"./utils/common":3,"./utils/strings":4,"./zlib/deflate.js":8,"./zlib/messages":13,"./zlib/zstream":15}],2:[function(require,module,exports){
'use strict';
@ -396,7 +409,9 @@ var toString = Object.prototype.toString;
*
* Uncompressed result, generated by default [[Inflate#onData]]
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
* (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Inflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -516,8 +531,9 @@ var Inflate = function(options) {
*
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
* new output chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Inflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the decompression context.
*
* On fail call [[Inflate#onEnd]] with error code and return false.
*
@ -573,7 +589,7 @@ Inflate.prototype.push = function(data, mode) {
}
if (strm.next_out) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
@ -599,6 +615,7 @@ Inflate.prototype.push = function(data, mode) {
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
}
// Finalize on the last chunk.
if (_mode === c.Z_FINISH) {
status = zlib_inflate.inflateEnd(this.strm);
@ -607,6 +624,13 @@ Inflate.prototype.push = function(data, mode) {
return status === c.Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === c.Z_SYNC_FLUSH) {
this.onEnd(c.Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -630,8 +654,9 @@ Inflate.prototype.onData = function(chunk) {
* - status (Number): inflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell inflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called either after you tell inflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Inflate.prototype.onEnd = function(status) {
@ -747,7 +772,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -778,7 +803,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -807,7 +832,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -835,6 +860,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
},{}],4:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@ -859,8 +885,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -929,7 +955,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -945,7 +971,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;
@ -1030,9 +1056,9 @@ exports.utf8border = function(buf, max) {
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -1055,6 +1081,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
},{}],6:[function(require,module,exports){
module.exports = {
@ -1103,6 +1130,7 @@ module.exports = {
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
},{}],7:[function(require,module,exports){
'use strict';
@ -1115,9 +1143,9 @@ module.exports = {
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -1131,12 +1159,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -1145,6 +1173,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
},{}],8:[function(require,module,exports){
'use strict';
@ -2682,7 +2711,7 @@ function deflate(strm, flush) {
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg){
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
@ -2911,6 +2940,7 @@ exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/
},{"../utils/common":3,"./adler32":5,"./crc32":7,"./messages":13,"./trees":14}],9:[function(require,module,exports){
'use strict';
@ -2931,7 +2961,7 @@ function GZheader() {
// but leave for few code modifications
//
// Setup limits is not necessary because in js we should not preallocate memory
// Setup limits is not necessary because in js we should not preallocate memory
// for inflate use constant limit in 65536 bytes
//
@ -2952,6 +2982,7 @@ function GZheader() {
}
module.exports = GZheader;
},{}],10:[function(require,module,exports){
'use strict';
@ -4783,6 +4814,7 @@ exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/
},{"../utils/common":3,"./adler32":5,"./crc32":7,"./inffast":10,"./inftrees":12}],12:[function(require,module,exports){
'use strict';
@ -4980,18 +5012,20 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
// poor man optimization - use if-else instead of switch,
// to avoid deopts in old v8
if (type === CODES) {
base = extra = work; /* dummy value--not used */
end = 19;
base = extra = work; /* dummy value--not used */
end = 19;
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
base = dbase;
extra = dext;
end = -1;
}
/* initialize opts for loop */
@ -5124,6 +5158,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
},{}],14:[function(require,module,exports){
'use strict';
@ -5558,7 +5593,7 @@ function tr_static_init() {
}
//Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
for (; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
_dist_code[256 + dist++] = code;
@ -6324,6 +6359,7 @@ exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
},{"../utils/common":3}],15:[function(require,module,exports){
'use strict';
@ -6354,6 +6390,7 @@ function ZStream() {
}
module.exports = ZStream;
},{}],"/":[function(require,module,exports){
// Top level file is just a mixin of submodules & constants
'use strict';
@ -6369,5 +6406,6 @@ var pako = {};
assign(pako, deflate, inflate, constants);
module.exports = pako;
},{"./lib/deflate":1,"./lib/inflate":2,"./lib/utils/common":3,"./lib/zlib/constants":6}]},{},[])("/")
});

6
dist/pako.min.js vendored

File diff suppressed because one or more lines are too long

68
dist/pako_deflate.js vendored
Wyświetl plik

@ -1,4 +1,4 @@
/* pako 0.2.6 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* pako 0.2.7 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
@ -13,7 +13,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -44,7 +44,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -73,7 +73,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -101,6 +101,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
},{}],2:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@ -125,8 +126,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -195,7 +196,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -211,7 +212,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;
@ -296,9 +297,9 @@ exports.utf8border = function(buf, max) {
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -321,6 +322,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
},{}],4:[function(require,module,exports){
'use strict';
@ -333,9 +335,9 @@ module.exports = adler32;
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -349,12 +351,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -363,6 +365,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
},{}],5:[function(require,module,exports){
'use strict';
@ -1900,7 +1903,7 @@ function deflate(strm, flush) {
put_byte(s, val);
} while (val !== 0);
if (s.gzhead.hcrc && s.pending > beg){
if (s.gzhead.hcrc && s.pending > beg) {
strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg);
}
if (val === 0) {
@ -2129,6 +2132,7 @@ exports.deflatePending = deflatePending;
exports.deflatePrime = deflatePrime;
exports.deflateTune = deflateTune;
*/
},{"../utils/common":1,"./adler32":3,"./crc32":4,"./messages":6,"./trees":7}],6:[function(require,module,exports){
'use strict';
@ -2143,6 +2147,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
},{}],7:[function(require,module,exports){
'use strict';
@ -2577,7 +2582,7 @@ function tr_static_init() {
}
//Assert (dist == 256, "tr_static_init: dist != 256");
dist >>= 7; /* from now on, all distances are divided by 128 */
for ( ; code < D_CODES; code++) {
for (; code < D_CODES; code++) {
base_dist[code] = dist << 7;
for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) {
_dist_code[256 + dist++] = code;
@ -3343,6 +3348,7 @@ exports._tr_stored_block = _tr_stored_block;
exports._tr_flush_block = _tr_flush_block;
exports._tr_tally = _tr_tally;
exports._tr_align = _tr_align;
},{"../utils/common":1}],8:[function(require,module,exports){
'use strict';
@ -3373,6 +3379,7 @@ function ZStream() {
}
module.exports = ZStream;
},{}],"/lib/deflate.js":[function(require,module,exports){
'use strict';
@ -3393,6 +3400,7 @@ var Z_FINISH = 4;
var Z_OK = 0;
var Z_STREAM_END = 1;
var Z_SYNC_FLUSH = 2;
var Z_DEFAULT_COMPRESSION = -1;
@ -3422,7 +3430,9 @@ var Z_DEFLATED = 8;
*
* Compressed result, generated by default [[Deflate#onData]]
* and [[Deflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Deflate#push]] with `Z_FINISH` / `true` param).
* (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Deflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -3546,8 +3556,9 @@ var Deflate = function(options) {
*
* Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
* new compressed chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Deflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the compression context.
*
* On fail call [[Deflate#onEnd]] with error code and return false.
*
@ -3600,7 +3611,7 @@ Deflate.prototype.push = function(data, mode) {
this.ended = true;
return false;
}
if (strm.avail_out === 0 || (strm.avail_in === 0 && _mode === Z_FINISH)) {
if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out)));
} else {
@ -3617,6 +3628,13 @@ Deflate.prototype.push = function(data, mode) {
return status === Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === Z_SYNC_FLUSH) {
this.onEnd(Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -3640,8 +3658,9 @@ Deflate.prototype.onData = function(chunk) {
* - status (Number): deflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell deflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called once after you tell deflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Deflate.prototype.onEnd = function(status) {
@ -3738,5 +3757,6 @@ exports.Deflate = Deflate;
exports.deflate = deflate;
exports.deflateRaw = deflateRaw;
exports.gzip = gzip;
},{"./utils/common":1,"./utils/strings":2,"./zlib/deflate.js":5,"./zlib/messages":6,"./zlib/zstream":8}]},{},[])("/lib/deflate.js")
});

File diff suppressed because one or more lines are too long

88
dist/pako_inflate.js vendored
Wyświetl plik

@ -1,4 +1,4 @@
/* pako 0.2.6 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* pako 0.2.7 nodeca/pako */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.pako = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
@ -13,7 +13,7 @@ exports.assign = function (obj /*from1, from2, from3, ...*/) {
var source = sources.shift();
if (!source) { continue; }
if (typeof(source) !== 'object') {
if (typeof source !== 'object') {
throw new TypeError(source + 'must be non-object');
}
@ -44,7 +44,7 @@ var fnTyped = {
return;
}
// Fallback to ordinary array
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -73,7 +73,7 @@ var fnTyped = {
var fnUntyped = {
arraySet: function (dest, src, src_offs, len, dest_offs) {
for(var i=0; i<len; i++) {
for (var i=0; i<len; i++) {
dest[dest_offs + i] = src[src_offs + i];
}
},
@ -101,6 +101,7 @@ exports.setTyped = function (on) {
};
exports.setTyped(TYPED_OK);
},{}],2:[function(require,module,exports){
// String encode/decode helpers
'use strict';
@ -125,8 +126,8 @@ try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPL
// Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS,
// because max possible codepoint is 0x10ffff
var _utf8len = new utils.Buf8(256);
for (var i=0; i<256; i++) {
_utf8len[i] = (i >= 252 ? 6 : i >= 248 ? 5 : i >= 240 ? 4 : i >= 224 ? 3 : i >= 192 ? 2 : 1);
for (var q=0; q<256; q++) {
_utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1);
}
_utf8len[254]=_utf8len[254]=1; // Invalid sequence start
@ -195,7 +196,7 @@ function buf2binstring(buf, len) {
}
var result = '';
for(var i=0; i < len; i++) {
for (var i=0; i < len; i++) {
result += String.fromCharCode(buf[i]);
}
return result;
@ -211,7 +212,7 @@ exports.buf2binstring = function(buf) {
// Convert binary string (typed, when possible)
exports.binstring2buf = function(str) {
var buf = new utils.Buf8(str.length);
for(var i=0, len=buf.length; i < len; i++) {
for (var i=0, len=buf.length; i < len; i++) {
buf[i] = str.charCodeAt(i);
}
return buf;
@ -296,9 +297,9 @@ exports.utf8border = function(buf, max) {
// Small size is preferable.
function adler32(adler, buf, len, pos) {
var s1 = (adler & 0xffff) |0
, s2 = ((adler >>> 16) & 0xffff) |0
, n = 0;
var s1 = (adler & 0xffff) |0,
s2 = ((adler >>> 16) & 0xffff) |0,
n = 0;
while (len !== 0) {
// Set limit ~ twice less than 5552, to keep
@ -321,6 +322,7 @@ function adler32(adler, buf, len, pos) {
module.exports = adler32;
},{}],4:[function(require,module,exports){
module.exports = {
@ -369,6 +371,7 @@ module.exports = {
Z_DEFLATED: 8
//Z_NULL: null // Use -1 or null inline, depending on var type
};
},{}],5:[function(require,module,exports){
'use strict';
@ -381,9 +384,9 @@ module.exports = {
function makeTable() {
var c, table = [];
for(var n =0; n < 256; n++){
for (var n =0; n < 256; n++) {
c = n;
for(var k =0; k < 8; k++){
for (var k =0; k < 8; k++) {
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
table[n] = c;
@ -397,12 +400,12 @@ var crcTable = makeTable();
function crc32(crc, buf, len, pos) {
var t = crcTable
, end = pos + len;
var t = crcTable,
end = pos + len;
crc = crc ^ (-1);
for (var i = pos; i < end; i++ ) {
for (var i = pos; i < end; i++) {
crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
}
@ -411,6 +414,7 @@ function crc32(crc, buf, len, pos) {
module.exports = crc32;
},{}],6:[function(require,module,exports){
'use strict';
@ -431,7 +435,7 @@ function GZheader() {
// but leave for few code modifications
//
// Setup limits is not necessary because in js we should not preallocate memory
// Setup limits is not necessary because in js we should not preallocate memory
// for inflate use constant limit in 65536 bytes
//
@ -452,6 +456,7 @@ function GZheader() {
}
module.exports = GZheader;
},{}],7:[function(require,module,exports){
'use strict';
@ -2283,6 +2288,7 @@ exports.inflateSync = inflateSync;
exports.inflateSyncPoint = inflateSyncPoint;
exports.inflateUndermine = inflateUndermine;
*/
},{"../utils/common":1,"./adler32":3,"./crc32":5,"./inffast":7,"./inftrees":9}],9:[function(require,module,exports){
'use strict';
@ -2480,18 +2486,20 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta
// poor man optimization - use if-else instead of switch,
// to avoid deopts in old v8
if (type === CODES) {
base = extra = work; /* dummy value--not used */
end = 19;
base = extra = work; /* dummy value--not used */
end = 19;
} else if (type === LENS) {
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
base = lbase;
base_index -= 257;
extra = lext;
extra_index -= 257;
end = 256;
} else { /* DISTS */
base = dbase;
extra = dext;
end = -1;
base = dbase;
extra = dext;
end = -1;
}
/* initialize opts for loop */
@ -2624,6 +2632,7 @@ module.exports = {
'-5': 'buffer error', /* Z_BUF_ERROR (-5) */
'-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */
};
},{}],11:[function(require,module,exports){
'use strict';
@ -2654,6 +2663,7 @@ function ZStream() {
}
module.exports = ZStream;
},{}],"/lib/inflate.js":[function(require,module,exports){
'use strict';
@ -2687,7 +2697,9 @@ var toString = Object.prototype.toString;
*
* Uncompressed result, generated by default [[Inflate#onData]]
* and [[Inflate#onEnd]] handlers. Filled after you push last chunk
* (call [[Inflate#push]] with `Z_FINISH` / `true` param).
* (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you
* push a chunk with explicit flush (call [[Inflate#push]] with
* `Z_SYNC_FLUSH` param).
**/
/**
@ -2807,8 +2819,9 @@ var Inflate = function(options) {
*
* Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
* new output chunks. Returns `true` on success. The last data block must have
* mode Z_FINISH (or `true`). That flush internal pending buffers and call
* [[Inflate#onEnd]].
* mode Z_FINISH (or `true`). That will flush internal pending buffers and call
* [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you
* can use mode Z_SYNC_FLUSH, keeping the decompression context.
*
* On fail call [[Inflate#onEnd]] with error code and return false.
*
@ -2864,7 +2877,7 @@ Inflate.prototype.push = function(data, mode) {
}
if (strm.next_out) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && _mode === c.Z_FINISH)) {
if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) {
if (this.options.to === 'string') {
@ -2890,6 +2903,7 @@ Inflate.prototype.push = function(data, mode) {
if (status === c.Z_STREAM_END) {
_mode = c.Z_FINISH;
}
// Finalize on the last chunk.
if (_mode === c.Z_FINISH) {
status = zlib_inflate.inflateEnd(this.strm);
@ -2898,6 +2912,13 @@ Inflate.prototype.push = function(data, mode) {
return status === c.Z_OK;
}
// callback interim results if Z_SYNC_FLUSH.
if (_mode === c.Z_SYNC_FLUSH) {
this.onEnd(c.Z_OK);
strm.avail_out = 0;
return true;
}
return true;
};
@ -2921,8 +2942,9 @@ Inflate.prototype.onData = function(chunk) {
* - status (Number): inflate status. 0 (Z_OK) on success,
* other if not.
*
* Called once after you tell inflate that input stream complete
* or error happenned. By default - join collected chunks,
* Called either after you tell inflate that the input stream is
* complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH)
* or if an error happened. By default - join collected chunks,
* free memory and fill `results` / `err` properties.
**/
Inflate.prototype.onEnd = function(status) {

File diff suppressed because one or more lines are too long