{“ast”:null,“code”:“'use strict';nnvar external = require("./external");nnvar DataWorker = require('./stream/DataWorker');nnvar DataLengthProbe = require('./stream/DataLengthProbe');nnvar Crc32Probe = require('./stream/Crc32Probe');nnvar DataLengthProbe = require('./stream/DataLengthProbe');n/**n * Represent a compressed object, with everything needed to decompress it.n * @constructorn * @param {number} compressedSize the size of the data compressed.n * @param {number} uncompressedSize the size of the data after decompression.n * @param {number} crc32 the crc32 of the decompressed file.n * @param {object} compression the type of compression, see lib/compressions.js.n * @param {String|ArrayBuffer|Uint8Array|Buffer} data the compressed data.n */nnnfunction CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {n this.compressedSize = compressedSize;n this.uncompressedSize = uncompressedSize;n this.crc32 = crc32;n this.compression = compression;n this.compressedContent = data;n}nnCompressedObject.prototype = {n /**n * Create a worker to get the uncompressed content.n * @return {GenericWorker} the worker.n */n getContentWorker: function getContentWorker() {n var worker = new DataWorker(external.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new DataLengthProbe("data_length"));n var that = this;n worker.on("end", function () {n if (this.streamInfo !== that.uncompressedSize) {n throw new Error("Bug : uncompressed data size mismatch");n }n });n return worker;n },nn /**n * Create a worker to get the compressed content.n * @return {GenericWorker} the worker.n */n getCompressedWorker: function getCompressedWorker() {n return new DataWorker(external.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);n }n};n/**n * Chain the given worker with other workers to compress the content with then * given compresion.n * @param {GenericWorker} uncompressedWorker the worker to pipe.n * @param {Object} compression the compression object.n * @param {Object} compressionOptions the options to use when compressing.n * @return {GenericWorker} the new worker compressing the content.n */nnCompressedObject.createWorkerFrom = function (uncompressedWorker, compression, compressionOptions) {n return uncompressedWorker.pipe(new Crc32Probe()).pipe(new DataLengthProbe("uncompressedSize")).pipe(compression.compressWorker(compressionOptions)).pipe(new DataLengthProbe("compressedSize")).withStreamInfo("compression", compression);n};nnmodule.exports = CompressedObject;”,“map”:null,“metadata”:{},“sourceType”:“module”}