first commit
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Sync to CNB / sync (push) Has been cancelled
Delete old workflow runs / del_runs (push) Has been cancelled
Upstream Sync / Sync latest commits from upstream repo (push) Has been cancelled

This commit is contained in:
2026-01-30 16:57:44 +08:00
commit 3d175d75af
119 changed files with 35834 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import archiver from "archiver";
import fs from "fs";
import path from "path";
export function createZipFile(
sourceDir: string,
zipPath: string,
englishName: string | null
): Promise<void> {
return new Promise((resolve, reject) => {
const output = fs.createWriteStream(zipPath);
const archive = archiver("zip", { zlib: { level: 9 } });
output.on("close", () => resolve());
archive.on("error", reject);
archive.pipe(output);
if (englishName) {
const files = fs.readdirSync(sourceDir);
const targetFiles = files.filter(
(f) => f.startsWith(englishName) && (f.endsWith(".in") || f.endsWith(".out"))
);
for (const file of targetFiles) {
archive.file(path.join(sourceDir, file), { name: file });
}
} else {
archive.directory(sourceDir, false);
}
archive.finalize();
});
}