1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2024-12-08 00:45:29 +01:00
programming-challenges/cli/utils/createTemporaryEmptyFolder.ts

14 lines
415 B
TypeScript
Raw Normal View History

import path from 'path'
import fs from 'fs'
import { isExistingPath } from '../utils/isExistingPath'
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)
}