UNPKG

@jeffy-g/unzip

Version:

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

55 lines (37 loc) 1.38 kB
![GitHub](https://img.shields.io/github/license/jeffy-g/rm-cstyle-cmts?style=flat) # @jeffy-g/unzip >use fflate unzip feature ## CLI usage ### command line name - **ffunzip** + all zip file extract to `<output directory>` If you need a detailed log, please specify the `-v` option. ``` $ ffunzip [-v] [-d <output directory>] <zip file> <zip file> <zip file> ... ``` + NOTE: if `-d` omitted then output directory to `./output` ## API ```js // DEVNOTE: 2024/01/01 - "colors.ts" available const unzipWithCallback = require("@jeffy-g/unzip"); /** @type {(path: TSimpleZipEntry) => void} */ const withCallback = e => { // means you are scanning for zip entries if (e.state === "info") { console.log(`zip info [${e.size? "f": "d"}]: ${e.path}`.gray); } else if (e.state === "File") { const state = e.state; const color = state === "pending" ? "cyan": "green"; console.log(`${state} - ${ e.path[color]}${state !== "write" ? `, size: ${e.size?.toLocaleString().blue}`: "" }`); } // else if (e.state === "ignore" || e.type === "Folder") { // // do nothing // } }; unzipWithCallback("[zipPath]", "[output directory]", withCallback); ``` > ## Authors - **jeffy-g** - [jeffy-g](https://github.com/jeffy-g) > ## License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details