diff --git a/archive/archive-internal.js b/archive/archive-internal.js index b4e25ab..446b5b2 100644 --- a/archive/archive-internal.js +++ b/archive/archive-internal.js @@ -225,13 +225,22 @@ export class UnarchiveExtractEvent extends UnarchiveEvent { this.worker_ = null; } + /** + * This method must be overridden by the subclass to return the script filename. + * @return {string} The MIME type of the archive. + * @protected. + */ + getMIMEType() { + throw 'Subclasses of Unarchiver must overload getMIMEType()'; + } + /** * This method must be overridden by the subclass to return the script filename. * @return {string} The script filename. * @protected. */ getScriptFileName() { - throw 'Subclasses of AbstractUnarchiver must overload getScriptFileName()'; + throw 'Subclasses of Unarchiver must overload getScriptFileName()'; } /** @@ -376,6 +385,7 @@ export class UnzipperInternal extends Unarchiver { super(arrayBuffer, createWorkerFn, options); } + getMIMEType() { return 'application/zip'; } getScriptFileName() { return 'archive/unzip.js'; } } @@ -384,6 +394,7 @@ export class UnrarrerInternal extends Unarchiver { super(arrayBuffer, createWorkerFn, options); } + getMIMEType() { return 'application/x-rar-compressed'; } getScriptFileName() { return 'archive/unrar.js'; } } @@ -392,6 +403,7 @@ export class UntarrerInternal extends Unarchiver { super(arrayBuffer, createWorkerFn, options); } + getMIMEType() { return 'application/x-tar'; } getScriptFileName() { return 'archive/untar.js'; }; }