UNPKG

ts-logs

Version:

This package provide a skd for audit and manager logs in nodejs and express

25 lines 850 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EnsureLocalFolder = void 0; const node_fs_1 = require("node:fs"); /** * @description Checks if the given path directory exists. If it does not exist, it creates the directory for the path informed recursively. * @param path dir to save log * @returns true if success and false if failure. */ const EnsureLocalFolder = async (path) => { const existsDir = (0, node_fs_1.existsSync)(path); if (!existsDir) { try { (0, node_fs_1.mkdirSync)(path, { recursive: true }); return true; } catch (error) { return (false); } } return (true); }; exports.EnsureLocalFolder = EnsureLocalFolder; exports.default = exports.EnsureLocalFolder; //# sourceMappingURL=ensure-local-folder.util.js.map