UNPKG

pux-to-html

Version:

Converts 1PUX (export from 1Password) file to HTML files

19 lines (16 loc) 478 B
import { existsSync } from "node:fs"; import { mkdir, writeFile as writeFileAsync } from "node:fs/promises"; import { dirname } from "node:path"; /** * Write content to the file and create directory if not exists * * @param {string} file * @param {string} content * @returns {Promise<*>} */ export async function writeFile(file, content) { if (!existsSync(dirname(file))) { await mkdir(dirname(file), { recursive: true }); } return writeFileAsync(file, content); }