"use strict";var StreamHelper=require("./stream/StreamHelper"),DataWorker=require("./stream/DataWorker"),utf8=require("./utf8"),CompressedObject=require("./compressedObject"),GenericWorker=require("./stream/GenericWorker"),ZipObject=function(e,r,t){this.name=e,this.dir=t.dir,this.date=t.date,this.comment=t.comment,this.unixPermissions=t.unixPermissions,this.dosPermissions=t.dosPermissions,this._data=r,this._dataBinary=t.binary,this.options={compression:t.compression,compressionOptions:t.compressionOptions}};ZipObject.prototype={internalStream:function(e){var r=e.toLowerCase(),t="string"===r||"text"===r;"binarystring"!==r&&"text"!==r||(r="string");var s=this._decompressWorker(),i=!this._dataBinary;return i&&!t&&(s=s.pipe(new utf8.Utf8EncodeWorker)),!i&&t&&(s=s.pipe(new utf8.Utf8DecodeWorker)),new StreamHelper(s,r,"")},async:function(e,r){return this.internalStream(e).accumulate(r)},nodeStream:function(e,r){return this.internalStream(e||"nodebuffer").toNodejsStream(r)},_compressWorker:function(e,r){if(this._data instanceof CompressedObject&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var t=this._decompressWorker();return this._dataBinary||(t=t.pipe(new utf8.Utf8EncodeWorker)),CompressedObject.createWorkerFrom(t,e,r)},_decompressWorker:function(){return this._data instanceof CompressedObject?this._data.getContentWorker():this._data instanceof GenericWorker?this._data:new DataWorker(this._data)}};for(var removedMethods=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],removedFn=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},i=0;i<removedMethods.length;i++)ZipObject.prototype[removedMethods[i]]=removedFn;module.exports=ZipObject;