feat: 写了点后端
This commit is contained in:
1 parent
e2079c5388
commit
79cc9c34d6
20 files changed
+219
-20
No files matched your search
@@ -0,0 +1,15 @@
|
||||
import fs from 'fs';
|
||||
|
||||
export default function mkdirIfNotExists(dir: string | string[]): void {
|
||||
if (typeof dir !== 'string') {
|
||||
dir.forEach((d) => mkdirIfNotExists(d));
|
||||
return;
|
||||
}
|
||||
if (!fs.existsSync(dir)) {
|
||||
try {
|
||||
fs.mkdirSync(dir, { recursive: true });
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user