This commit is contained in:
telangpu
2026-05-07 23:00:28 +08:00
parent 40067a1ea1
commit f421220d77
273 changed files with 34552 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
const fs = require("fs");
const archiver = require("archiver");
// 创建一个输出流到指定的 zip 文件
const output = fs.createWriteStream(__dirname + "/../../zip/a4_se_post_instabox.zip"); // 这里可以更改为你想要的文件名
const archive = archiver("zip", {
zlib: { level: 9 }, // 设置压缩级别
});
// 监听关闭事件,打印压缩完成信息
output.on("close", function () {
console.log(archive.pointer() + " total bytes");
console.log(
"archiver has been finalized and the output file descriptor has closed."
);
});
// 捕获警告
archive.on("warning", function (err) {
if (err.code === "ENOENT") {
// log warning
} else {
throw err;
}
});
// 捕获错误
archive.on("error", function (err) {
throw err;
});
// 将输出流管道到归档文件
archive.pipe(output);
// 添加目录到归档文件
archive.directory("dist/", false);
// 完成归档
archive.finalize();