Lines Matching +defs:e +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
65 // We can detect that the string input looks like a data url but we
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");
364 this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false);
397 this._pako.onData = function(data) {
399 data : data,
529 // The correct values are put in the data descriptor immediately
530 // following the compressed data.
706 * Generate data descriptors for a file entry.
709 * @return {String} the data descriptors.
780 this.bytesWritten += chunk.data.length;
783 data : chunk.data,
806 data : record.fileRecord,
826 // after the streamed file, we put data descriptors
828 data : generateDataDescriptors(streamInfo),
835 data : record.fileRecord,
853 data : this.dirRecords[i],
862 data : dirEnd,
887 previous.on("data", function (chunk) {
898 previous.on("error", function (e) {
899 self.error(e);
925 ZipFileWorker.prototype.error = function (e) {
927 if(!GenericWorker.prototype.error.call(this, e)) {
932 sources[i].error(e);
933 } catch(e) {
1005 } catch (e) {
1006 zipFileWorker.error(e);
1032 // "folder/data.txt" : {...}
1086 worker.on("error", function (e) {
1087 reject(e);
1100 module.exports = function (data, options) {
1110 if (nodejsUtils.isNode && nodejsUtils.isStream(data)) {
1114 return utils.prepareContent("the loaded zip file", data, true, options.optimizedBinaryString, options.base64)
1115 .then(function (data) {
1117 zipEntries.load(data);
1189 .on("data", function (chunk) {
1191 data: chunk,
1197 .on("error", function (e) {
1199 this.generatedError = e;
1201 self.error(e);
1256 helper.on("data", function (data, meta) {
1257 if (!self.push(data)) {
1264 .on("error", function(e) {
1265 self.emit("error", e);
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);
1430 promise is useless because file(name, data) returns the JSZip
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);
1697 } catch (e) {
1699 worker.error(e);
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);
2156 }, function (e) {
2157 self.error(e);
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);
2304 } catch (e) {
2305 this.emit("error", e);
2311 * @param {Error} e the error which caused the premature end.
2314 error : function (e) {
2320 this.generatedError = e;
2324 this.emit("error", e);
2330 this.previous.error(e);
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) {
2399 previous.on("error", function (e) {
2400 self.error(e);
2519 } catch(e) {
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);
2605 } catch (e) {
2606 reject(e);
2618 * @param {String} outputType the type of data expected by the use
2645 } catch(e) {
2647 this._worker.error(e);
2670 if(evt === "data") {
2672 fn.call(self, chunk.data, chunk.meta);
2742 catch (e) {
2749 catch (e) {
2757 } catch(e) {
2942 * @param {Array|Uint8Array|Buffer} buf the data de decode
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),
3073 * memory consumed is nearly 100 times the original data amount.
3087 catch (e) {
3096 catch (e) {
3180 } catch (e) {
3190 } catch (e) {
3226 } catch (e) {
3241 * Copy the data from an array-like to an other array-like.
3362 * All empty components, e.g. "//", are removed.
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);
3499 reader.onload = function(e) {
3500 resolve(e.target.result);
3502 reader.onerror = function(e) {
3503 reject(e.target.error);
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;
3704 // get unreadable data.
3723 record is too small to hold required data, the field
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 !
3888 // the fileName is stored as binary data, the handleUTF8 method will take care of the encoding.
4112 * @param {String|ArrayBuffer|Uint8Array|Buffer} data the data
4115 var ZipObject = function(name, data, options) {
4123 this._data = data;
4159 } catch (e) {
4161 result.error(e);
4250 element.data = (called = ++called % 2);
4401 } catch (e) {
4402 return handlers.reject(promise, e);
4487 } catch (e) {
4489 out.value = e;
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
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`.
4948 * , data = Uint8Array([1,2,3,4,5,6,7,8,9]);
4950 * console.log(pako.deflate(data));
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.
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
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
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
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:
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
7794 /* true if compressed data believed to be text */
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 */
8274 var BAD = 30; /* got a data error -- remain here until reset */
8323 this.length = 0; /* literal or length of data to copy */
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.
9558 strm.msg = 'incorrect data check';
9845 The length counts are used for other purposes as well, i.e. finding
9942 all codes of length max, i.e. all codes, have been processed. This
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.
11378 /* best guess about the data type: binary or text */
11380 /* adler32 value of the uncompressed data */
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.