perf: 优化跳过处理逻辑

This commit is contained in:
xiaojunnuo
2024-09-06 10:19:03 +08:00
parent 3bad0b2685
commit b80210f24b
6 changed files with 67 additions and 41 deletions

View File

@@ -79,10 +79,15 @@ export class CertReader {
} finally {
//删除临时文件
logger.info("删除临时文件");
fs.unlinkSync(tmpCrtPath);
fs.unlinkSync(tmpKeyPath);
fs.unlinkSync(tmpPfxPath);
fs.unlinkSync(tmpDerPath);
function removeFile(filepath?: string) {
if (filepath) {
fs.unlinkSync(filepath);
}
}
removeFile(tmpCrtPath);
removeFile(tmpKeyPath);
removeFile(tmpPfxPath);
removeFile(tmpDerPath);
}
}