Lines Matching +defs:t +defs:data
13 (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.JSZip = 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){
59 var dataUrlPrefix = "data:";
62 // This is a common error: people give a data url
63 // (data:image/png;base64,iVBOR...) with a {base64: true} and
64 // wonders why things don't work.
65 // We can detect that the string input looks like a data url but we
66 // *can't* be sure it is one: removing everything up to the comma would
68 throw new Error("Invalid base64 input, it looks like a data url.");
132 * @param {number} compressedSize the size of the data compressed.
133 * @param {number} uncompressedSize the size of the data after decompression.
136 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data.
138 function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {
143 this.compressedContent = data;
159 throw new Error("Bug : uncompressed data size mismatch");
243 var t = crcTable, end = pos + len;
248 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
267 var t = crcTable, end = pos + len;
272 crc = (crc >>> 8) ^ t[(crc ^ str.charCodeAt(i)) & 0xFF];
364 this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false);
387 * TODO: lazy-loading this object isn't the best solution but it's the
397 this._pako.onData = function(data) {
399 data : data,
456 // I can't use octal values in strict mode, hence the hexa.
529 // The correct values are put in the data descriptor immediately
530 // following the compressed data.
578 // breaks on p7zip which doesn't seek the unicode path extra field.
706 * Generate data descriptors for a file entry.
709 * @return {String} the data descriptors.
735 // The number of bytes written so far. This doesn't count accumulated chunks.
780 this.bytesWritten += chunk.data.length;
783 data : chunk.data,
802 // don't stream folders (because they don't have any content)
806 data : record.fileRecord,
826 // after the streamed file, we put data descriptors
828 data : generateDataDescriptors(streamInfo),
832 // the content wasn't streamed, we need to push everything now
835 data : record.fileRecord,
853 data : this.dirRecords[i],
862 data : dirEnd,
887 previous.on("data", function (chunk) {
1032 // "folder/data.txt" : {...}
1059 // a require('package.json').version doesn't work with webpack, see #327
1100 module.exports = function (data, options) {
1110 if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
1111 return external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file."));
1114 return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64)
1115 .then(function (data) {
1117 zipEntries.load(data);
1181 * Do this ASAP on node 0.10 ! A lazy binding doesn't always work.
1189 .on("data", function (chunk) {
1191 data: chunk,
1256 helper.on("data", function (data, meta) {
1257 if (!self.push(data)) {
1285 * In a browser, browserify won't include this file and the whole module
1291 * @param {Object} data the data to pass to the constructor.
1295 newBufferFrom: function(data, encoding) {
1297 return Buffer.from(data, encoding);
1299 if (typeof data === "number") {
1302 throw new Error("The \"data\" argument must not be a number");
1304 return new Buffer(data, encoding);
1356 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data of the file
1360 var fileAdd = function(name, data, originalOptions) {
1362 var dataType = utils.getTypeOf(data),
1402 var isCompressedEmpty = (data instanceof CompressedObject) && data.uncompressedSize === 0;
1404 if (isCompressedEmpty || o.dir || !data || data.length === 0) {
1407 data = "";
1417 if (data instanceof CompressedObject || data instanceof GenericWorker) {
1418 zipObjectContent = data;
1419 } else if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
1420 zipObjectContent = new NodejsStreamInputAdapter(name, data);
1422 zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);
1428 TODO: we can't throw an exception because we have async promises
1430 promise is useless because file(name, data) returns the JSZip
1464 path += "/"; // IE doesn't like substr(-1)
1551 * @param {string|RegExp} name The name of the file to add (if data is defined),
1552 * the name of the file to find (if no data) or a regex to match files.
1553 * @param {String|ArrayBuffer|Uint8Array|Buffer} data The file data, either raw or base64 encoded
1558 file: function(name, data, o) {
1575 else { // more than one argument : we have data !
1577 fileAdd.call(this, name, data, o);
1741 function ArrayReader(data) {
1742 DataReader.call(this, data);
1743 for(var i = 0; i < this.data.length; i++) {
1744 data[i] = data[i] & 0xFF;
1752 return this.data[this.zero + i];
1763 if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) {
1778 data = this.readData(4);
1779 return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
1789 var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
1799 function DataReader(data) {
1800 this.data = data; // type : see implementation
1801 this.length = data.length;
1821 throw new Error("End of data reached (data length = " + this.length + ", asked index = " + (newIndex) + "). Corrupted zip ?");
1827 * @throws {Error} if the new index is out of the data.
1836 * @throws {Error} if the new index is out of the data.
1873 * Get raw data without conversion, <size> bytes.
1875 * @return {Object} the raw data, implementation specific.
1918 function NodeBufferReader(data) {
1919 Uint8ArrayReader.call(this, data);
1928 var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
1939 function StringReader(data) {
1940 DataReader.call(this, data);
1947 return this.data.charCodeAt(this.zero + i);
1953 return this.data.lastIndexOf(sig) - this.zero;
1959 var data = this.readData(4);
1960 return sig === data;
1968 var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
1979 function Uint8ArrayReader(data) {
1980 ArrayReader.call(this, data);
1992 var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
2009 * Create a reader adapted to the data.
2010 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data to read.
2011 * @return {DataReader} the data reader.
2013 module.exports = function (data) {
2014 var type = utils.getTypeOf(data);
2017 return new StringReader(data);
2020 return new NodeBufferReader(data);
2023 return new Uint8ArrayReader(utils.transformTo("uint8array", data));
2025 return new ArrayReader(utils.transformTo("array", data));
2059 data : utils.transformTo(this.destType, chunk.data),
2073 * A worker which calculate the crc32 of the data flowing through.
2086 this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0);
2098 * A worker which calculate the total length of the data flowing through.
2115 this.streamInfo[this.propName] = length + chunk.data.length;
2135 * @param {Promise} dataP the promise of the data to split
2143 this.data = null;
2148 dataP.then(function (data) {
2150 self.data = data;
2151 self.max = data && data.length || 0;
2152 self.type = utils.getTypeOf(data);
2168 this.data = null;
2211 var data = null, nextIndex = Math.min(this.max, this.index + size);
2218 data = this.data.substring(this.index, nextIndex);
2221 data = this.data.subarray(this.index, nextIndex);
2225 data = this.data.slice(this.index, nextIndex);
2230 data : data,
2250 * A chunk is an object with 2 attributes : `meta` and `data`. The former is an
2252 * details. The latter is the real data (String, Uint8Array, etc).
2274 "data":[],
2288 this.emit("data", chunk);
2339 * @param {String} name the name of the event (data, end, error)
2356 * @param {String} name the name of the event (data, end, error)
2393 previous.on("data", function (chunk) {
2405 * Pause the stream so it doesn't send events anymore.
2525 * Apply the final transformation of the data. If the user wants a Blob for
2545 * Concatenate an array of data of the given type.
2546 * @param {String} type the type of the data in the given array.
2547 * @param {Array} dataArray the array containing the data chunks to concatenate
2548 * @return {String|Uint8Array|Buffer} the concatenated data
2591 .on("data", function (data, meta) {
2592 dataArray.push(data);
2618 * @param {String} outputType the type of data expected by the use
2670 if(evt === "data") {
2672 fn.call(self, chunk.data, chunk.meta);
2706 // is strange and I don't know if it would be useful.
2942 * @param {Array|Uint8Array|Buffer} buf the data de decode
2961 // the last bytes if a chunk didn't end with a complete codepoint.
2971 var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data);
2976 var previousData = data;
2977 data = new Uint8Array(previousData.length + this.leftOver.length);
2978 data.set(this.leftOver, 0);
2979 data.set(previousData, this.leftOver.length);
2981 data = this.leftOver.concat(data);
2986 var nextBoundary = utf8border(data);
2987 var usableData = data;
2988 if (nextBoundary !== data.length) {
2990 usableData = data.subarray(0, nextBoundary);
2991 this.leftOver = data.subarray(nextBoundary, data.length);
2993 usableData = data.slice(0, nextBoundary);
2994 this.leftOver = data.slice(nextBoundary, data.length);
2999 data : exports.utf8decode(usableData),
3010 data : exports.utf8decode(this.leftOver),
3032 data : exports.utf8encode(chunk.data),
3068 * an Uint8Array because the stock browser of android 4 won't accept it (it
3073 * memory consumed is nearly 100 times the original data amount.
3099 throw new Error("Bug : can't construct the Blob.");
3241 * Copy the data from an array-like to an other array-like.
3341 * @throws {Error} an Error if the browser doesn't support the requested output type.
3346 // an empty string won't harm.
3410 * @throws {Error} an Error if the browser doesn't support the requested type.
3464 * @return {Object} a new object with the data of the others.
3490 var promise = external.Promise.resolve(inputData).then(function(data) {
3493 var isBlob = support.blob && (data instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(data)) !== -1);
3505 reader.readAsArrayBuffer(data);
3508 return data;
3512 return promise.then(function(data) {
3513 var dataType = exports.getTypeOf(data);
3517 new Error("Can't read the data of '" + name + "'. Is it " +
3523 data = exports.transformTo("uint8array", data);
3526 data = base64.decode(data);
3533 data = string2binary(data);
3537 return data;
3611 * I don't want to read the wrong number of bytes !
3684 // We expected some records but couldn't find ANY.
3704 // get unreadable data.
3708 throw new Error("Can't find end of central directory : is this a zip file ? " +
3711 throw new Error("Corrupted zip: can't find end of central directory");
3723 record is too small to hold required data, the field
3746 throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
3757 throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
3780 // this happens if data has been prepended (crx files for example)
3787 prepareReader: function(data) {
3788 this.reader = readerFor(data);
3792 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the binary string representing a zip file.
3794 load: function(data) {
3795 this.prepareReader(data);
3870 // If the central dir data are false, we are doomed.
3871 // On the bright side, the local part is scary : zip64, data descriptors, both, etc.
3872 // The less data we get here, the more reliable this should be.
3873 // Let's skip the whole header and dash to the data !
3887 localExtraFieldsLength = reader.readInt(2); // can't be sure this will be the same as the central dir
3888 // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding.
3893 throw new Error("Bug or corrupted zip : didn't get enough information from the central directory " + "(compressedSize === -1 || uncompressedSize === -1)");
3978 // won't let us have more.
4112 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data
4115 var ZipObject = function(name, data, options) {
4123 this._data = data;
4250 element.data = (called = ++called % 2);
4632 * Generic JS-style wrapper for zlib calls. If you don't need
4640 * Chunks of output data, if [[Deflate#onData]] not overriden.
4687 * - `chunkSize` - size of generated data chunks (16K by default)
4693 * - `text` (Boolean) - true if compressed data believed to be text
4696 * - `extra` (Array) - array of bytes with extra data (max 65536)
4744 this.chunks = []; // chunks of compressed data
4768 // Convert data if needed
4789 * Deflate#push(data[, mode]) -> Boolean
4790 * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be
4795 * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with
4796 * new compressed chunks. Returns `true` on success. The last data block must have
4804 * array format is detected automatically). Also, don't skip last param and always
4812 * push(chunk, false); // push one of data chunks
4817 Deflate.prototype.push = function (data, mode) {
4826 // Convert data if needed
4827 if (typeof data === 'string') {
4829 strm.input = strings.string2buf(data);
4830 } else if (toString.call(data) === '[object ArrayBuffer]') {
4831 strm.input = new Uint8Array(data);
4833 strm.input = data;
4882 * - chunk (Uint8Array|Array|String): ouput data. Type of array depends
4886 * By default, stores data blocks in `chunks[]` property and glue
4920 * deflate(data[, options]) -> Uint8Array|Array|String
4921 * - data (Uint8Array|Array|String): input data to compress.
4924 * Compress `data` with deflate algorithm and `options`.
4939 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
4948 * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);
4950 * console.log(pako.deflate(data));
4958 // That will never happens, if you don't cheat with options :)
4966 * deflateRaw(data[, options]) -> Uint8Array|Array|String
4967 * - data (Uint8Array|Array|String): input data to compress.
4970 * The same as [[deflate]], but creates raw data, without wrapper
4981 * gzip(data[, options]) -> Uint8Array|Array|String
4982 * - data (Uint8Array|Array|String): input data to compress.
5017 * Generic JS-style wrapper for zlib calls. If you don't need
5025 * Chunks of output data, if [[Inflate#onData]] not overriden.
5042 * Should be checked if broken data possible.
5067 * - `chunkSize` - size of generated data chunks (16K by default)
5073 * By default, when no options set, autodetect deflate/gzip data format via
5104 // Force window size for `raw` data, if not set directly,
5120 // bit 3 (16) -> gzipped data
5130 this.chunks = []; // chunks of compressed data
5150 * Inflate#push(data[, mode]) -> Boolean
5151 * - data (Uint8Array|Array|ArrayBuffer|String): input data
5155 * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with
5156 * new output chunks. Returns `true` on success. The last data block must have
5164 * format is detected automatically). Also, don't skip last param and always
5172 * push(chunk, false); // push one of data chunks
5177 Inflate.prototype.push = function (data, mode) {
5186 // when we check that all output data was flushed.
5192 // Convert data if needed
5193 if (typeof data === 'string') {
5195 strm.input = strings.binstring2buf(data);
5196 } else if (toString.call(data) === '[object ArrayBuffer]') {
5197 strm.input = new Uint8Array(data);
5199 strm.input = data;
5215 // Convert data if needed
5262 // When no more input data, we should check that internal inflate buffers
5264 // inflate pass. But if output data not exists, inflate return Z_BUF_ERROR.
5300 * - chunk (Uint8Array|Array|String): ouput data. Type of array depends
5304 * By default, stores data blocks in `chunks[]` property and glue
5340 * inflate(data[, options]) -> Uint8Array|Array|String
5341 * - data (Uint8Array|Array|String): input data to decompress.
5344 * Decompress `data` with inflate/ungzip and `options`. Autodetect
5345 * format via wrapper header by default. That's why we don't provide
5357 * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify
5383 // That will never happens, if you don't cheat with options :)
5391 * inflateRaw(data[, options]) -> Uint8Array|Array|String
5392 * - data (Uint8Array|Array|String): input data to decompress.
5395 * The same as [[inflate]], but creates raw data, without wrapper
5406 * ungzip(data[, options]) -> Uint8Array|Array|String
5407 * - data (Uint8Array|Array|String): input data to decompress.
5474 // calculate data length
5715 // It doesn't worth to make additional optimizationa as in original.
5837 // Note: we can't get significant speed boost here.
5880 var t = crcTable,
5886 crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF];
6018 var OS_CODE = 0x03; // Unix :) . Don't detect, use this default.
6278 zlib, so we don't care about this pathological case.)
6348 /* If the WIN_INIT bytes after the end of the current data have never been
6360 // /* Previous high water mark below current data -- zero WIN_INIT
6370 // /* High water mark at or above current data, but below current data
6371 // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
6390 * uncompressible data is probably not useful. This function is used
6450 * negative and the data will be gone:
7065 // That's alias to max_lazy_match, don't use directly
7082 /* Didn't use ct_data typedef below to suppress compiler warning */
7127 * data is still in the window so we can still emit a stored block even
7134 * adaptation to changes in the input data statistics. (Take for
7139 * - I can't count above 4
7275 // Don't need mem init magic for JS.
7532 * avail_in equal to zero. There won't be anything to do,
7573 * that the flush is complete. So we don't have to output an
7794 /* true if compressed data believed to be text */
7805 this.extra_len = 0; // Actually, we don't need it in JS,
7854 var BAD = 30; /* got a data error -- remain here until reset */
7860 available, an end-of-block is encountered, or a data error is encountered.
7877 BAD -- error in block data
7950 input data or output space */
8036 // don't enable it for binary compatibility
8162 /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
8274 var BAD = 30; /* got a data error -- remain here until reset */
8323 this.length = 0; /* literal or length of data to copy */
8346 because we don't have pointers in js, we use lencode and distcode directly
8347 as buffers so we don't need codes
8508 It is also called to create a window for dictionary data when a dictionary
8514 output will fall in the output data, making match copies simpler and faster.
8515 The advantage may be dependent on the size of the processor's data caches.
8521 /* if it hasn't been done already, allocate space for the window */
9491 // don't enable it for binary compatibility
9558 strm.msg = 'incorrect data check';
10109 '-3': 'data error', /* Z_DATA_ERROR (-3) */
10239 * Local data. These are initialized only once.
10289 // show if `static_tree` has data or dummy - needed for monomorphic objects
10616 // Now data ready and we can init static trees
10663 //charf *buf; /* the input data */
10728 * Send the block data compressed using the given Huffman trees
11087 * Check if the data type is TEXT or BINARY, using the following algorithm:
11135 * Initialize the tree data structures for a new zlib stream.
11205 // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
11209 // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
11212 * the compressed block data, excluding the tree representations.
11239 * Otherwise we can't have processed more than WSIZE input bytes since
11302 // don't enable it for binary compatibility
11378 /* best guess about the data type: binary or text */
11380 /* adler32 value of the uncompressed data */
11473 // where `global.postMessage` means something completely different and can't be used for this purpose.
11494 typeof event.data === "string" &&
11495 event.data.indexOf(messagePrefix) === 0) {
11496 runIfPresent(+event.data.slice(messagePrefix.length));
11514 var handle = event.data;
11549 // Don't get fooled by e.g. browserify environments.