UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

22 lines (18 loc) 397 B
/*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/writeFile.ts import fs from "fs"; import path from "path"; function writeFile(filename, content) { const dir = path.dirname(filename); if (!fs.existsSync(dir)) { fs.mkdirSync(dir, { recursive: true }); } fs.writeFileSync(filename, content); } export { writeFile };