UNPKG

@tsed/prisma

Version:

Generate Ts.ED JsonSchema based on Prisma models

16 lines (14 loc) 494 B
import {promises as fs} from "node:fs"; import path from "node:path"; export default async function removeDir(dirPath: string, onlyContent: boolean) { const dirEntries = await fs.readdir(dirPath, {withFileTypes: true}); await Promise.all( dirEntries.map((dirEntry) => { const fullPath = path.join(dirPath, dirEntry.name); return dirEntry.isDirectory() ? removeDir(fullPath, false) : fs.unlink(fullPath); }) ); if (!onlyContent) { await fs.rmdir(dirPath); } }