UNPKG

@jeffy-g/unzip

Version:

![GitHub](https://img.shields.io/github/license/jeffy-g/rm-cstyle-cmts?style=flat)

51 lines (44 loc) 1.29 kB
/*! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Copyright (C) 2024 jeffy-g <hirotom1107@gmail.com> Released under the MIT license https://opensource.org/licenses/mit-license.php - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ import * as ff from "fflate"; declare global { type UnzipFileFilter = ff.UnzipFileFilter; type UnzipFileInfo = ff.UnzipFileInfo; /** * @param e When one unzip process completes, the zip file path is passed. */ type TUnzipCallback = (e: TSimpleZipEntry | string) => void; type TSimpleZipEntry = { state: "ignore" | "pending" | "write" | "info"; type: "File" | "Folder"; path: string; size?: number; }; type TRawZipEntry = [string, Uint8Array]; type TForEachCallback = (e: TRawZipEntry) => void; type TUnzipArgs = { /** * output directory */ d: string; /** * want verbose log? */ v?: true; }; } /** * @param {string} fileName zip file path * @param {string} destDir output directory path * @param {TUnzipCallback} cb */ declare function unzipWithCallback(fileName: string, destDir: string, cb: TUnzipCallback): void; declare namespace unzipWithCallback { const version: string; } export = unzipWithCallback;