import JSZip from 'jszip'; import { ZipEntry } from './StreamZip'; import { EventEmitter } from 'events'; import { FolderEntry } from './FolderArchive'; /** * string: Filename. WILL USE STREAMING METHOD. * * number[] | Uint8Array | ArrayBuffer: Array of bytes * * Blob: File for browser. WILL USE STREAMING METHOD. * * JSZip | Archive: Existing archives */ export type AcceptedZipSources = string | number[] | Uint8Array | ArrayBuffer | Blob | JSZip | Archive; export type ConstructibleArchives = BaseArchive | BaseArchive | BaseArchive; export interface BaseArchive { ready: () => Promise; dir: (name: string) => BaseArchive; has: (name: string) => boolean; search: (query: RegExp) => T[]; searchDir: (query: RegExp) => T[]; get: (name: string, type?: "text" | "arraybuffer" | "blob", parse_auto?: boolean) => Promise; read: (file: T, type?: "text" | "arraybuffer" | "blob", parse_auto?: boolean) => Promise; ls: (current_dir_only?: boolean) => { [name: string]: T; }; fromFile: (name: string | T) => Promise; events: EventEmitter; } export declare function constructArchive(archive: AcceptedZipSources): ConstructibleArchives; export declare class Archive implements BaseArchive { protected _ready: Promise; protected archive: JSZip; events: EventEmitter<[never]>; constructor(file: AcceptedZipSources); ready(): Promise; dir(name: string): Archive; has(name: string): boolean; get(name: string, type?: "text" | "arraybuffer" | "blob", parse_auto?: boolean): Promise; search(query: RegExp): JSZip.JSZipObject[]; searchDir(query: RegExp): JSZip.JSZipObject[]; read(file: JSZip.JSZipObject, type?: "text" | "arraybuffer" | "blob", parse_auto?: boolean): Promise; ls(current_dir_only?: boolean): { [name: string]: JSZip.JSZipObject; }; /** * Create a new instance of Archive from a file contained in this archive. * * @param name File name or file object */ fromFile(name: string | JSZip.JSZipObject): Promise; get raw(): JSZip; } export default Archive;