1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-11-09 22:08:58 +01:00
programming-challenges/cli/utils/createTemporaryEmptyFolder.ts
2022-02-19 18:30:29 +01:00

14 lines
428 B
TypeScript

import path from 'node:path'
import fs from 'node:fs'
import { isExistingPath } from '../utils/isExistingPath.js'
export const TEMPORARY_PATH = path.join(__dirname, '..', '..', 'temp')
export const createTemporaryEmptyFolder = async (): Promise<void> => {
if (await isExistingPath(TEMPORARY_PATH)) {
await fs.promises.rm(TEMPORARY_PATH, { recursive: true, force: true })
}
await fs.promises.mkdir(TEMPORARY_PATH)
}