当前位置:网站首页>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))
边栏推荐
- EMC circuit protection device for surge and impulse current protection
- Which app is better and more secure for stock mobile account opening
- Various global files related to [.Net core] program
- Halcon knowledge: an attempt of 3D reconstruction
- S32Kxxx bootloader之UDS bootloader
- 记录一下大文件上传偶然成功偶然失败问题
- Use pair to do unordered_ Key value of map
- Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
- Flow control statement of SQL data analysis [if, case... When detailed]
- cookie、session、tooken
猜你喜欢

【QT】对于Qt MSVC 2017无法编译的问题解决

.env.xxx 文件,加了常量,却undefined
![Window sorting functions rank and deny for SQL data analysis_ rank、raw_ Number and lag, lead window offset function [usage sorting]](/img/3a/cced28a2eea9f9a0d107baabd01119.png)
Window sorting functions rank and deny for SQL data analysis_ rank、raw_ Number and lag, lead window offset function [usage sorting]

Windows10 install WSL (I) (wslregisterdistribution error)

Use vb Net to convert PNG pictures into icon type icon files

Download the online video m3u8 tutorial

Leetcode96 different binary search trees

回顾数据脱敏系统

SQL数据分析之流程控制语句【if,case...when详解】

Concurrentskiplistmap -- principle of table skipping
随机推荐
Asp .NetCore 微信订阅号自动回复之文本篇
heketi 记录
ADO. Net SqlConnection object usage summary
Selectively inhibiting learning bias for active sampling
Jielizhi Bluetooth headset quality control and production skills [chapter]
Openwrt enable kV roaming
How to realize parallel replication in MySQL replication
Correlation - intra group correlation coefficient
Data analysis methodology and previous experience summary [notes dry goods]
Jielizhi, production line assembly link [chapter]
Leetcode 96 différents arbres de recherche binaires
Resumption of attack and defense drill
Ldr6035 smart Bluetooth audio can continuously charge and discharge mobile devices
Windows installation WSL (II)
Kubernetes resource object introduction and common commands (III)
From 20s to 500ms, I used these three methods
一个实习生的CnosDB之旅
vs2015 AdminDeployment. xml
Regular expression collection
Halcon knowledge: an attempt of 3D reconstruction