
Hello, I recently wrote a command line tool for compressing files, and I would like to share it with you today.
was due to some uncontrollable circumstances in the former company. I recently changed jobs and switched from Mac to Win. When I used Mac before, I was used to terminal operations. Now I use Win, and I don’t feel very comfortable with it, even though Win comes with it. powershell is also very powerful.
The projects developed at work need to be compressed into compressed packages before testing, and then uploaded to the corresponding desktop application for testing.
Most of the compression software downloaded from the Internet comes bundled with advertisements.
The compression command in powershell is too long and inconvenient to use. Moreover, after the desktop application IDE is upgraded, files compressed by Compress-Archive cannot be correctly parsed.
The last reason is that I don’t want to learn powershell commands anymore! ! !

Based on the above reasons, I wrote a compression tool fzip using nodejs
with Compress-Archive Use
fzip to compressfzip -f ./test
Compress-Archive to compressCompress-Archive -Path ./test -DestinationPath ./ test.zip #Explain the parameters# -Path Source# -DestinationPath
The two instructions above the output location will compress the test directory in the current directory into a zip package, but the instructions for using powershell are really long! Is there any!
Of course, fzip also supports specifying the output location and naming the compressed package. Not only that, it also supports setting the compression level! There will be detailed documentation for you below!
npm to installnpm install @lxqddd/fzip -g
yarn to installyarn install @lxqddd/fzip -g
pnpm to installpnpm install @lxqddd/fzip -g
| Parameter | parameter source | Parameter annotation |
|---|---|---|
| -f | From | compression target source (required Optional) |
| -o | Output | compression product output location (optional, if not passed, it will be the same level directory as the source) |
| -l | Level | compression level 0~9 (optional, if not passed, the default is 6) |
| -n | Name | compressed package name (optional) , if not passed, it will default to the name of the file or directory) |
. ├── LICENSE ├── README.md ├── gulpfile.js ├── package.json ├── src │ ├── cli.ts │ ├── core │ │ └── index.ts │ ├── types │ │ └── index.ts │ └── utils │ └── index.ts ├── tsconfig.json └──
# After the command is executed, a compressed package of `src.zip` will be output in the directory of the same level as `src`. fzip -f ./src
# After the command is executed, a compressed package of `src.zip` will be output on the desktop. The compressed package of `src.zip` fzip -f ./src -o ~/Desktop
# The compression level of the compression product is 9 fzip -f ./src -o ~/Desktop -l
# After the command is executed, a compressed package named `test.zip` will be output in the general directory of `src` fzip -f ./src -n The test
mentioned above all compresses the directory, and can also compress a single file. The usage method is similar. You only need to point the input path to the compressed target file to
# After the command is executed, a file named `test. zip` compressed package fzip -f ./src/cli.ts -o ~/Desktop -n test -l 9
Project address: https://github.com/lxqddd/FZip