elm-pages
Version:
Hybrid Elm framework with full-stack and static routes.
16 lines (13 loc) • 327 B
JavaScript
import * as fs from "node:fs";
export function ensureDirSync(dirpath) {
try {
fs.mkdirSync(dirpath, { recursive: true });
} catch (err) {
if (err.code !== "EEXIST") throw err;
}
}
export function deleteIfExists(/** @type string */ filePath) {
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
}