at path:
ROOT
/
sistema
/
vendors
/
jszip
/
lib
/
compressedObject.js
run:
R
W
Run
generate
DIR
2026-04-09 04:12:40
R
W
Run
nodejs
DIR
2026-04-09 04:12:40
R
W
Run
reader
DIR
2026-04-09 04:12:40
R
W
Run
stream
DIR
2026-04-09 04:12:40
R
W
Run
base64.js
3.31 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
compressedObject.js
2.84 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
compressions.js
368 By
2018-11-08 02:46:18
R
W
Run
Delete
Rename
crc32.js
1.88 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
defaults.js
284 By
2018-11-08 02:46:18
R
W
Run
Delete
Rename
external.js
459 By
2018-11-08 02:46:18
R
W
Run
Delete
Rename
flate.js
2.31 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
index.js
1.32 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
license_header.js
392 By
2018-11-08 02:46:18
R
W
Run
Delete
Rename
load.js
2.76 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
nodejsUtils.js
1.75 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
object.js
12.23 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
readable-stream-browser.js
427 By
2018-11-08 02:46:18
R
W
Run
Delete
Rename
signature.js
294 By
2018-11-08 02:46:18
R
W
Run
Delete
Rename
support.js
1.06 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
utf8.js
7.92 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
utils.js
15.31 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
zipEntries.js
11.62 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
zipEntry.js
11 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
zipObject.js
4.42 KB
2018-11-08 02:46:18
R
W
Run
Delete
Rename
error_log
up
📄
compressedObject.js
Save
'use strict'; var external = require("./external"); var DataWorker = require('./stream/DataWorker'); var DataLengthProbe = require('./stream/DataLengthProbe'); var Crc32Probe = require('./stream/Crc32Probe'); var DataLengthProbe = require('./stream/DataLengthProbe'); /** * Represent a compressed object, with everything needed to decompress it. * @constructor * @param {number} compressedSize the size of the data compressed. * @param {number} uncompressedSize the size of the data after decompression. * @param {number} crc32 the crc32 of the decompressed file. * @param {object} compression the type of compression, see lib/compressions.js. * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data. */ function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) { this.compressedSize = compressedSize; this.uncompressedSize = uncompressedSize; this.crc32 = crc32; this.compression = compression; this.compressedContent = data; } CompressedObject.prototype = { /** * Create a worker to get the uncompressed content. * @return {GenericWorker} the worker. */ getContentWorker : function () { var worker = new DataWorker(external.Promise.resolve(this.compressedContent)) .pipe(this.compression.uncompressWorker()) .pipe(new DataLengthProbe("data_length")); var that = this; worker.on("end", function () { if(this.streamInfo['data_length'] !== that.uncompressedSize) { throw new Error("Bug : uncompressed data size mismatch"); } }); return worker; }, /** * Create a worker to get the compressed content. * @return {GenericWorker} the worker. */ getCompressedWorker : function () { return new DataWorker(external.Promise.resolve(this.compressedContent)) .withStreamInfo("compressedSize", this.compressedSize) .withStreamInfo("uncompressedSize", this.uncompressedSize) .withStreamInfo("crc32", this.crc32) .withStreamInfo("compression", this.compression) ; } }; /** * Chain the given worker with other workers to compress the content with the * given compresion. * @param {GenericWorker} uncompressedWorker the worker to pipe. * @param {Object} compression the compression object. * @param {Object} compressionOptions the options to use when compressing. * @return {GenericWorker} the new worker compressing the content. */ CompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) { return uncompressedWorker .pipe(new Crc32Probe()) .pipe(new DataLengthProbe("uncompressedSize")) .pipe(compression.compressWorker(compressionOptions)) .pipe(new DataLengthProbe("compressedSize")) .withStreamInfo("compression", compression); }; module.exports = CompressedObject;