perf: 优化micro解压的-x参数

This commit is contained in:
2025-03-11 16:26:39 +08:00
parent c96674349c
commit 64c93cecdb
4 changed files with 18 additions and 2 deletions

View File

@@ -1,7 +1,11 @@
import fs from 'fs';
export const fileIsExist = (filePath: string) => {
export const fileIsExist = (filePath: string, isFile = false) => {
try {
// 检查文件或者目录是否存在
fs.accessSync(filePath, fs.constants.F_OK);
if (isFile) {
fs.accessSync(filePath, fs.constants.R_OK);
}
return true;
} catch (error) {
return false;