UNPKG

openapi-ts-json-schema

Version:

Generate TypeScript-first JSON schemas from OpenAPI definitions

9 lines (8 loc) 314 B
import fs from 'fs/promises'; import nodePath from 'node:path'; export async function saveFile({ path, data, }) { const absolutePath = nodePath.resolve(...path); const dirname = nodePath.dirname(absolutePath); await fs.mkdir(dirname, { recursive: true }); await fs.writeFile(absolutePath, data); }