UNPKG

@foal/cli

Version:

CLI tool for FoalTS

25 lines (24 loc) 606 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.rmdir = rmdir; // std const promises_1 = require("node:fs/promises"); /** * Remove a directory and all its contents, including any subdirectories and files. * * @export * @param {string} path - The path of the directory * @returns {Promise<void>} */ async function rmdir(path) { try { await (0, promises_1.readdir)(path); } catch (error) { if (error.code === 'ENOENT') { return; } throw error; } await (0, promises_1.rm)(path, { recursive: true }); }