This commit is contained in:
2025-03-10 10:50:06 +08:00
commit 81c79275aa
65 changed files with 3648 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import fs from 'fs';
export const checkFileExists = (filePath: string, checkIsFile = false) => {
try {
fs.accessSync(filePath);
if (checkIsFile) {
return fs.statSync(filePath).isFile();
}
return true;
} catch (error) {
return false;
}
};
export const createDir = (dirPath: string) => {
if (!checkFileExists(dirPath)) {
fs.mkdirSync(dirPath, { recursive: true });
}
return dirPath;
};