![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
// DEVNOTE: 2024/01/01 - "colors" 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
License
This project is licensed under the MIT License - see the LICENSE file for details