UNPKG

expodoc

Version:

A tool to generate API documentation automatically for Express.js applications.

25 lines (24 loc) 901 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ensureDirectoryExists = ensureDirectoryExists; exports.readFile = readFile; exports.writeFile = writeFile; exports.fileExists = fileExists; const node_fs_1 = require("node:fs"); const node_path_1 = require("node:path"); function ensureDirectoryExists(filePath) { const dir = (0, node_path_1.dirname)(filePath); if (!(0, node_fs_1.existsSync)(dir)) { (0, node_fs_1.mkdirSync)(dir, { recursive: true }); } } function readFile(filePath) { return (0, node_fs_1.readFileSync)((0, node_path_1.resolve)(filePath), "utf8"); } function writeFile(filePath, content) { ensureDirectoryExists(filePath); (0, node_fs_1.writeFileSync)((0, node_path_1.resolve)(filePath), content, "utf8"); } function fileExists(filePath) { return (0, node_fs_1.existsSync)((0, node_path_1.resolve)(filePath)); }