@gitcobra/anzip-es6
Version:
create an uncompressed zip file
96 lines (95 loc) • 2.4 kB
TypeScript
type AcceptableDataTypes = number[] | Uint8Array | ArrayBuffer | Buffer | string;
export default class AnZip {
private _zippedBlob;
private _resolvingCRCPromise;
/**
* directory record
*/
private _dirRecords;
private _dirRecList;
private _dirRecFileList;
/**
* local file headers
* [LocalFileHeaderStart, samePartLocalAndCentral, pathArray, file?]
*/
private _localFileChunks;
/**
* current local file header offset
*/
private _curLocalFileHeaderOffset;
/**
* central directory headers
* [CentralDirHeaderStart, samePartLocalAndCentral, centralRest, localOffset, pathArray]
*/
private _centralDirHeaderChunks;
/**
* whole central directory header size
*/
private _centralDirHeaderLen;
/**
* path count
*/
private _pathCount;
/**
* file count
*/
private _fileCount;
/**
* total size of all files
*/
private _dataSize;
static getCRC32(dat: AcceptableDataTypes | Blob): void;
/**
* AnZip constructor
*/
constructor();
/**
* initialize data
* @memberof AnZip
* @param { boolean } [blobMode]
* @return {void}
*/
clear(): void;
/**
* add path and data
*/
add(path: string, data?: Blob | AcceptableDataTypes, dateArg?: any, precalculatedCRC?: number): Promise<number>;
private _resolveBlobCRC;
private _checkPending;
private _getFileRecord;
/**
* return whether the path exists
*/
has(path: string): boolean;
size(): number;
count(all?: boolean): number;
get(index: number | string): Blob | Uint8Array | Buffer | null;
get(index: number | string, blobType: string): Blob | null;
getPathByIndex(index: number): string;
remove(index: number | string): boolean;
list(includeDirFlag?: boolean): {
size: number;
isFile: boolean;
path: string;
}[];
buffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
/**
* output as dataURL
*/
url(): Promise<string>;
urlSync(): string;
wait(deepWait?: boolean): Promise<void>;
/**
* construct a zip structure as a Blob
*/
private _buildZipBlob;
private _createCurrentBlobParts;
/**
* output zip as Blob
*/
zip(close?: boolean): Promise<Blob>;
zipSync(close?: boolean): Blob;
private _close;
}
export {};