-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { add } from "node-7z"; | ||
|
||
// 定义要压缩的目录和压缩后的文件名 | ||
const sourceDir = "dist"; | ||
const outputZip = `${sourceDir}/dist.7z`; | ||
|
||
console.log(`Compressing ${sourceDir} to ${outputZip}...`); | ||
|
||
// 创建 Seven 对象 | ||
const myStream = add(outputZip, sourceDir); | ||
|
||
// 监听压缩进度事件 | ||
myStream.on("progress", (progress) => { | ||
console.log(`Compression progress: ${progress}%`); | ||
}); | ||
|
||
// 监听压缩完成事件 | ||
myStream.on("end", () => { | ||
console.log("Compression done"); | ||
}); | ||
|
||
// 监听错误事件 | ||
myStream.on("error", (err) => { | ||
console.error("Compression error:", err); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters