当前位置:网站首页>Node——添加压缩文件
Node——添加压缩文件
2022-07-02 00:15:00 【一只漫步前行的羊】
【compressing】
1. 下载依赖
cnpm i -S compressing
2. 添加目录压缩
const compressing = require("compressing")
const zip = compressing.zip
let folderPath = `E:/development/myProject/pc-dev-tool/tools` //文件夹路径
let target = `E:/development/myProject/pc-dev-tool/upload/file.zip` //压缩文件存放地址
zip.compressDir(folderPath,target).then(()=>{
console.log("压缩完成")
}).catch(()=>{
console.log("压缩失败")
});
3. 多个文件压缩
const compressing = require("compressing")
const fs = require("fs")
const tarStream = new compressing.zip.Stream()
tarStream.addEntry(`E:/development/myProject/pc-dev-tool/tools/code_compress.js`)
tarStream.addEntry(`E:/development/myProject/pc-dev-tool/tools/replace_dist.js`)
tarStream.addEntry(`E:/development/myProject/pc-dev-tool/tools/test.js`)
let target = `E:/development/myProject/pc-dev-tool/upload/file.zip` //压缩文件存放地址
tarStream.pipe(fs.createWriteStream(target))
边栏推荐
- Is it safe to buy funds on Great Wall Securities?
- Review data desensitization system
- Flow control statement of SQL data analysis [if, case... When detailed]
- Resumption of attack and defense drill
- Material design component - use bottomsheet to show extended content (I)
- Use the htaccess file to prohibit the script execution permission in the directory
- . env. XXX file, with constant, but undefined
- PyTorch学习记录
- [embedded system course design] a single key controls the LED light
- Record the accidental success and failure of uploading large files
猜你喜欢

S32Kxxx bootloader之UDS bootloader

PyTorch学习记录

智能运维实战:银行业务流程及单笔交易追踪

Qt5.12.9 migration tutorial based on Quanzhi H3

GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速

Selectively inhibiting learning bias for active sampling
![Jielizhi, production line assembly link [chapter]](/img/1d/d1736fad33c428e61f450aad512ce0.png)
Jielizhi, production line assembly link [chapter]

比较通俗易懂的PID理解

Kubernetes resource object introduction and common commands (III)

E-commerce RPA robot helps brand e-commerce to achieve high traffic
随机推荐
挖财学堂开户打新债安全可靠嘛?
正则表达式收集
Windows10 install WSL (I) (wslregisterdistribution error)
LeetCode中等题题分享(5)
多表操作-一对一,一对多与多对多
. env. XXX file, with constant, but undefined
How excel opens CSV files with more than one million lines
Openwrt enable kV roaming
[embedded system course design] a single key controls the LED light
Deep learning | three concepts: epoch, batch, iteration
Key points of security agreement
Is it safe and reliable to open an account in Caixue school and make new debts?
How to improve data quality
Heketi record
Algolia's search needs are almost closed
[QT] QT cannot find a solution to the compiler using msvc2017
Is it safe for qiniu college to open an account? How to open an account?
Flow control statement of SQL data analysis [if, case... When detailed]
九州云与英特尔联合发布智慧校园私有云框架,赋能教育新基建
SQL Server 安装指南