Skip to content

Commit

Permalink
modify mkdirpath (#4288)
Browse files Browse the repository at this point in the history
Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
  • Loading branch information
mgrabowski84 and lukastaegert committed Dec 9, 2021
1 parent dbcf24a commit 3834c87
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/utils/fs.ts
Expand Up @@ -10,18 +10,7 @@ export const readFile = (file: string): Promise<string> =>

function mkdirpath(path: string) {
const dir = dirname(path);
try {
fs.readdirSync(dir);
} catch {
mkdirpath(dir);
try {
fs.mkdirSync(dir);
} catch (err: any) {
if (err.code !== 'EEXIST') {
throw err;
}
}
}
fs.mkdirSync(dir, { recursive: true });
}

export function writeFile(dest: string, data: string | Uint8Array): Promise<void> {
Expand Down

0 comments on commit 3834c87

Please sign in to comment.