重构任务执行逻辑

This commit is contained in:
whyour
2022-05-15 20:40:29 +08:00
parent bb47d67d0b
commit 9dcc547ac7
7 changed files with 204 additions and 190 deletions
+8
View File
@@ -232,6 +232,14 @@ export async function fileExist(file: any) {
});
}
export async function createFile(file: string, data: string = '') {
return new Promise((resolve) => {
fs.mkdirSync(path.dirname(file), { recursive: true });
fs.writeFileSync(file, data);
resolve(true);
});
}
export async function concurrentRun(
fnList: Array<() => Promise<any>> = [],
max = 5,