1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-03 17:49:16 +02:00

Add a getMIMEType() method to Unarchiver

This commit is contained in:
Jeff Schiller 2021-06-20 13:49:23 -07:00
parent cd847d1b71
commit 4496948aaf

View file

@ -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'; };
}