perf: 优化micro解压的-x参数
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user