UNPKG

openapi-ts-json-schema

Version:

OpenAPI to JSON schema generator with TypeScript in mind

16 lines (15 loc) 688 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.saveFile = void 0; const promises_1 = __importDefault(require("fs/promises")); const node_path_1 = __importDefault(require("node:path")); async function saveFile({ path, data, }) { const absolutePath = node_path_1.default.resolve(...path); const dirname = node_path_1.default.dirname(absolutePath); await promises_1.default.mkdir(dirname, { recursive: true }); await promises_1.default.writeFile(absolutePath, data); } exports.saveFile = saveFile;