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

Remove decompress-internal.js and pathToBitJS for decompress.

This commit is contained in:
Jeff Schiller 2023-12-12 21:04:41 -08:00
parent d557383c9d
commit eeb228a52b
9 changed files with 369 additions and 482 deletions

View file

@ -1,149 +0,0 @@
/**
* Factory method that creates an unarchiver based on the byte signature found
* in the arrayBuffer.
* @param {ArrayBuffer} ab
* @param {Function(string):Promise<*>} connectPortFn A function that connects the impl port.
* @param {Object|string} options An optional object of options, or a string representing where
* the path to the unarchiver script files.
* @returns {Unarchiver}
*/
export function getUnarchiverInternal(ab: ArrayBuffer, connectPortFn: any, options?: any | string): Unarchiver;
export namespace ThreadingMode {
const WEB_WORKER: string;
}
/**
* @typedef UnarchiverOptions
* @property {string} pathToBitJS The path to the bitjs folder.
* @property {boolean=} debug Set to true for verbose unarchiver logging.
* @property {ThreadingMode=} threadingMode The default is WEB_WORKER.
*/
/**
* Base class for all Unarchivers.
*/
export class Unarchiver extends EventTarget {
/**
* @param {ArrayBuffer} arrayBuffer The Array Buffer. Note that this ArrayBuffer must not be
* referenced once it is sent to the Unarchiver, since it is marked as Transferable and sent
* to the decompress implementation.
* @param {Function(string, MessagePort):Promise<*>} connectPortFn A function that takes a path
* to a JS decompression implementation (unzip.js) and connects it to a MessagePort.
* @param {UnarchiverOptions|string} options An optional object of options, or a string
* representing where the BitJS files are located. The string version of this argument is
* deprecated.
*/
constructor(arrayBuffer: ArrayBuffer, connectPortFn: any, options?: UnarchiverOptions | string);
/**
* The client-side port that sends messages to, and receives messages from the
* decompressor implementation.
* @type {MessagePort}
* @private
*/
private port_;
/**
* The ArrayBuffer object.
* @type {ArrayBuffer}
* @protected
*/
protected ab: ArrayBuffer;
/**
* A factory method that connects a port to the decompress implementation.
* @type {Function(MessagePort): Promise<*>}
* @private
*/
private connectPortFn_;
/**
* The path to the BitJS files.
* @type {string}
* @private
*/
private pathToBitJS_;
/**
* @orivate
* @type {boolean}
*/
debugMode_: boolean;
/**
* This method must be overridden by the subclass to return the script filename.
* @returns {string} The MIME type of the archive.
* @protected.
*/
protected getMIMEType(): string;
/**
* This method must be overridden by the subclass to return the script filename.
* @returns {string} The script filename.
* @protected.
*/
protected getScriptFileName(): string;
/**
* Create an UnarchiveEvent out of the object sent back from the implementation.
* @param {Object} obj
* @returns {UnarchiveEvent}
* @private
*/
private createUnarchiveEvent_;
/**
* Receive an event and pass it to the listener functions.
*
* @param {Object} obj
* @private
*/
private handlePortEvent_;
/**
* Starts the unarchive by connecting the ports and sending the first ArrayBuffer.
*/
start(): void;
/**
* Adds more bytes to the unarchiver.
* @param {ArrayBuffer} ab The ArrayBuffer with more bytes in it. If opt_transferable is
* set to true, this ArrayBuffer must not be referenced after calling update(), since it
* is marked as Transferable and sent to the implementation.
* @param {boolean=} opt_transferable Optional boolean whether to mark this ArrayBuffer
* as a Tranferable object, which means it can no longer be referenced outside of
* the implementation context.
*/
update(ab: ArrayBuffer, opt_transferable?: boolean | undefined): void;
/**
* Closes the port to the decompressor implementation and terminates it.
*/
stop(): void;
}
export class UnzipperInternal extends Unarchiver {
constructor(arrayBuffer: any, connectPortFn: any, options: any);
}
export class UnrarrerInternal extends Unarchiver {
constructor(arrayBuffer: any, connectPortFn: any, options: any);
}
export class UntarrerInternal extends Unarchiver {
constructor(arrayBuffer: any, connectPortFn: any, options: any);
}
export type UnarchivedFile = {
filename: string;
fileData: Uint8Array;
};
export type UnarchiverOptions = {
/**
* The path to the bitjs folder.
*/
pathToBitJS: string;
/**
* Set to true for verbose unarchiver logging.
*/
debug?: boolean | undefined;
/**
* The default is WEB_WORKER.
*/
threadingMode?: {
WEB_WORKER: string;
} | undefined;
};
import { UnarchiveAppendEvent } from "./events.js";
import { UnarchiveErrorEvent } from "./events.js";
import { UnarchiveEvent } from "./events.js";
import { UnarchiveEventType } from "./events.js";
import { UnarchiveExtractEvent } from "./events.js";
import { UnarchiveFinishEvent } from "./events.js";
import { UnarchiveInfoEvent } from "./events.js";
import { UnarchiveProgressEvent } from "./events.js";
import { UnarchiveStartEvent } from "./events.js";
export { UnarchiveAppendEvent, UnarchiveErrorEvent, UnarchiveEvent, UnarchiveEventType, UnarchiveExtractEvent, UnarchiveFinishEvent, UnarchiveInfoEvent, UnarchiveProgressEvent, UnarchiveStartEvent };
//# sourceMappingURL=decompress-internal.d.ts.map

View file

@ -1 +0,0 @@
{"version":3,"file":"decompress-internal.d.ts","sourceRoot":"","sources":["../../archive/decompress-internal.js"],"names":[],"mappings":"AA+PA;;;;;;;;GAQG;AACF,0CANU,WAAW,gCAEX,MAAO,MAAM,GAEX,UAAU,CAkBtB;;;;AA3PD;;;;;GAKG;AAEH;;GAEG;AACH;IASE;;;;;;;;;OASG;IACH,yBATW,WAAW,gCAKX,iBAAiB,GAAC,MAAM,EAuClC;IArDD;;;;;OAKG;IACH,cAAM;IAqBJ;;;;OAIG;IACH,cAHU,WAAW,CAGA;IAErB;;;;OAIG;IACH,uBAAmC;IAEnC;;;;OAIG;IACH,qBAA8C;IAE9C;;;OAGG;IACH,YAFU,OAAO,CAEkB;IAGrC;;;;OAIG;IACH,yBAHa,MAAM,CAKlB;IAED;;;;OAIG;IACH,+BAHa,MAAM,CAKlB;IAED;;;;;OAKG;IACH,8BAsBC;IAED;;;;;OAKG;IACH,yBAWC;IAED;;OAEG;IACH,cA2BC;IAED;;;;;;;;OAQG;IACH,WAPW,WAAW,qBAGX,OAAO,oBAgBjB;IAED;;OAEG;IACH,aAKC;CACF;AAED;IACE,gEAEC;CAIF;AAED;IACE,gEAEC;CAIF;AAED;IACE,gEAEC;CAIF;;cA3Oa,MAAM;cACN,UAAU;;;;;;iBAYV,MAAM;;;;YACN,OAAO"}

View file

@ -1,30 +1,130 @@
/**
* Factory method that creates an unarchiver based on the byte signature found
* in the ArrayBuffer.
* @param {ArrayBuffer} ab The ArrayBuffer to unarchive. Note that this ArrayBuffer
* must not be referenced after calling this method, as the ArrayBuffer may be
* transferred to a different JS context once start() is called.
* @param {UnarchiverOptions|string} options An optional object of options, or a
* string representing where the path to the unarchiver script files. The latter
* is now deprecated (use UnarchiverOptions).
* @returns {Unarchiver}
*/
* Factory method that creates an unarchiver based on the byte signature found
* in the ArrayBuffer.
* @param {ArrayBuffer} ab The ArrayBuffer to unarchive. Note that this ArrayBuffer
* must not be referenced after calling this method, as the ArrayBuffer may be
* transferred to a different JS context once start() is called.
* @param {UnarchiverOptions|string} options An optional object of options, or a
* string representing where the path to the unarchiver script files. The latter
* is now deprecated (use UnarchiverOptions).
* @returns {Unarchiver}
*/
export function getUnarchiver(ab: ArrayBuffer, options?: UnarchiverOptions | string): Unarchiver;
export class Unzipper extends UnzipperInternal {
constructor(ab: any, options: any);
/**
* Base class for all Unarchivers.
*/
export class Unarchiver extends EventTarget {
/**
* @param {ArrayBuffer} arrayBuffer The Array Buffer. Note that this ArrayBuffer must not be
* referenced once it is sent to the Unarchiver, since it is marked as Transferable and sent
* to the decompress implementation.
* @param {Function(string, MessagePort):Promise<*>} connectPortFn A function that takes a path
* to a JS decompression implementation (unzip.js) and connects it to a MessagePort.
* @param {UnarchiverOptions|string} options An optional object of options, or a string
* representing where the BitJS files are located. The string version of this argument is
* deprecated.
*/
constructor(arrayBuffer: ArrayBuffer, connectPortFn: any, options?: UnarchiverOptions | string);
/**
* The client-side port that sends messages to, and receives messages from the
* decompressor implementation.
* @type {MessagePort}
* @private
*/
private port_;
/**
* The ArrayBuffer object.
* @type {ArrayBuffer}
* @protected
*/
protected ab: ArrayBuffer;
/**
* A factory method that connects a port to the decompress implementation.
* @type {Function(MessagePort): Promise<*>}
* @private
*/
private connectPortFn_;
/**
* @orivate
* @type {boolean}
*/
debugMode_: boolean;
/**
* This method must be overridden by the subclass to return the script filename.
* @returns {string} The MIME type of the archive.
* @protected.
*/
protected getMIMEType(): string;
/**
* This method must be overridden by the subclass to return the script filename.
* @returns {string} The script filename.
* @protected.
*/
protected getScriptFileName(): string;
/**
* Create an UnarchiveEvent out of the object sent back from the implementation.
* @param {Object} obj
* @returns {UnarchiveEvent}
* @private
*/
private createUnarchiveEvent_;
/**
* Receive an event and pass it to the listener functions.
*
* @param {Object} obj
* @private
*/
private handlePortEvent_;
/**
* Starts the unarchive by connecting the ports and sending the first ArrayBuffer.
*/
start(): void;
/**
* Adds more bytes to the unarchiver.
* @param {ArrayBuffer} ab The ArrayBuffer with more bytes in it. If opt_transferable is
* set to true, this ArrayBuffer must not be referenced after calling update(), since it
* is marked as Transferable and sent to the implementation.
* @param {boolean=} opt_transferable Optional boolean whether to mark this ArrayBuffer
* as a Tranferable object, which means it can no longer be referenced outside of
* the implementation context.
*/
update(ab: ArrayBuffer, opt_transferable?: boolean | undefined): void;
/**
* Closes the port to the decompressor implementation and terminates it.
*/
stop(): void;
}
export class Unrarrer extends UnrarrerInternal {
constructor(ab: any, options: any);
export class Unzipper extends Unarchiver {
/**
* @param {ArrayBuffer} ab
* @param {UnarchiverOptions} options
*/
constructor(ab: ArrayBuffer, options?: UnarchiverOptions);
}
export class Untarrer extends UntarrerInternal {
constructor(ab: any, options: any);
export class Unrarrer extends Unarchiver {
/**
* @param {ArrayBuffer} ab
* @param {UnarchiverOptions} options
*/
constructor(ab: ArrayBuffer, options?: UnarchiverOptions);
}
export class Untarrer extends Unarchiver {
/**
* @param {ArrayBuffer} ab
* @param {UnarchiverOptions} options
*/
constructor(ab: ArrayBuffer, options?: UnarchiverOptions);
}
export type UnarchivedFile = {
filename: string;
fileData: Uint8Array;
};
export type UnarchiverOptions = import('./decompress-internal.js').UnarchiverOptions;
import { Unarchiver } from "./decompress-internal.js";
export type UnarchiverOptions = {
/**
* Set to true for verbose unarchiver logging.
*/
debug?: boolean | undefined;
};
import { UnarchiveAppendEvent } from "./events.js";
import { UnarchiveErrorEvent } from "./events.js";
import { UnarchiveEvent } from "./events.js";
@ -34,8 +134,5 @@ import { UnarchiveFinishEvent } from "./events.js";
import { UnarchiveInfoEvent } from "./events.js";
import { UnarchiveProgressEvent } from "./events.js";
import { UnarchiveStartEvent } from "./events.js";
import { UnzipperInternal } from "./decompress-internal.js";
import { UnrarrerInternal } from "./decompress-internal.js";
import { UntarrerInternal } from "./decompress-internal.js";
export { UnarchiveAppendEvent, UnarchiveErrorEvent, UnarchiveEvent, UnarchiveEventType, UnarchiveExtractEvent, UnarchiveFinishEvent, UnarchiveInfoEvent, UnarchiveProgressEvent, UnarchiveStartEvent, Unarchiver };
export { UnarchiveAppendEvent, UnarchiveErrorEvent, UnarchiveEvent, UnarchiveEventType, UnarchiveExtractEvent, UnarchiveFinishEvent, UnarchiveInfoEvent, UnarchiveProgressEvent, UnarchiveStartEvent };
//# sourceMappingURL=decompress.d.ts.map

View file

@ -1 +1 @@
{"version":3,"file":"decompress.d.ts","sourceRoot":"","sources":["../../archive/decompress.js"],"names":[],"mappings":"AAmFA;;;;;;;;;;EAUE;AACF,kCARU,WAAW,YAGX,iBAAiB,GAAC,MAAM,GAGtB,UAAU,CAIrB;AAzBD;IACE,mCAA+D;CAChE;AAED;IACE,mCAA+D;CAChE;AAED;IACE,mCAA+D;CAChE;;cA7Ca,MAAM;cACN,UAAU;;gCAIX,OAAO,0BAA0B,EAAE,iBAAiB"}
{"version":3,"file":"decompress.d.ts","sourceRoot":"","sources":["../../archive/decompress.js"],"names":[],"mappings":"AAmSA;;;;;;;;;;GAUG;AACH,kCARW,WAAW,YAGX,iBAAiB,GAAC,MAAM,GAGtB,UAAU,CAkBtB;AA5PD;;GAEG;AACH;IASE;;;;;;;;;OASG;IACH,yBATW,WAAW,gCAKX,iBAAiB,GAAC,MAAM,EAgClC;IA9CD;;;;;OAKG;IACH,cAAM;IAqBJ;;;;OAIG;IACH,cAHU,WAAW,CAGA;IAErB;;;;OAIG;IACH,uBAAmC;IAEnC;;;OAGG;IACH,YAFU,OAAO,CAEkB;IAGrC;;;;OAIG;IACH,yBAHa,MAAM,CAKlB;IAED;;;;OAIG;IACH,+BAHa,MAAM,CAKlB;IAED;;;;;OAKG;IACH,8BAsBC;IAED;;;;;OAKG;IACH,yBAWC;IAED;;OAEG;IACH,cA0BC;IAED;;;;;;;;OAQG;IACH,WAPW,WAAW,qBAGX,OAAO,oBAgBjB;IAED;;OAEG;IACH,aAKC;CACF;AAID;IACE;;;OAGG;IACH,gBAHW,WAAW,YACX,iBAAiB,EAI3B;CAIF;AAED;IACE;;;OAGG;IACH,gBAHW,WAAW,YACX,iBAAiB,EAI3B;CAIF;AAED;IACE;;;OAGG;IACH,gBAHW,WAAW,YACX,iBAAiB,EAI3B;CAIF;;cA/Pa,MAAM;cACN,UAAU;;;;;;YAKV,OAAO"}