当前位置:网站首页>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))
边栏推荐
- Shell process control
- Learn online case practice
- 【QT】QtCreator卸载与安装(非正常状态)
- 【CMake】Qt creator 里面的 cmake 配置
- E-commerce RPA robot helps brand e-commerce to achieve high traffic
- 【QT】对于Qt MSVC 2017无法编译的问题解决
- Dongge cashes in and the boss retires?
- Which app is better and more secure for stock mobile account opening
- Qt5.12.9 migration tutorial based on Quanzhi H3
- 启牛商学院给的证券账户安不安全?哪里可以开户
猜你喜欢
随机推荐
【QT】测试Qt是否能连接上数据库
Linux centos7 installation Oracle11g super perfect novice tutorial
ERP项目施行计划的目的是什么?
实例讲解将Graph Explorer搬上JupyterLab
Concurrentskiplistmap -- principle of table skipping
二叉搜索树的创建,查找,添加,删除操作
Various global files related to [.Net core] program
Is it safe to choose mobile phone for stock trading account opening in Beijing?
Graduation season | Huawei experts teach the interview secret: how to get a high paying offer from a large factory?
SQL数据分析之流程控制语句【if,case...when详解】
The origin of usb-if Association and various interfaces
起床困难综合症(按位贪心)
How to solve the image pop-up problem when pycharm calls Matplotlib to draw
[es practice] safe operation mode on ES
MySQL Replication中并行复制怎么实现
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
时间复杂度与空间复杂度
Qt5.12.9 migration tutorial based on Quanzhi H3
heketi 记录
Use vb Net to convert PNG pictures into icon type icon files