(baseDir: string)
| 32 | } |
| 33 | |
| 34 | export async function ensureDirectoryExists(baseDir: string) { |
| 35 | try { |
| 36 | await mkdir(baseDir, { recursive: true }); |
| 37 | return; |
| 38 | } catch (error) { |
| 39 | const fsError = error as NodeJS.ErrnoException; |
| 40 | logger.warn(fsError.message); |
| 41 | if (fsError.code !== 'EEXIST') { |
| 42 | throw error; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | export async function removeDirectoryIfExists(dir: string) { |
| 48 | if (await directoryExists(dir)) { |
no test coverage detected