protoml-parser
Version:
ProtoML is a lightweight, declarative markup language designed for writing and structuring meeting protocols, notes and task lists in a human-readable and machine-parseable format.
17 lines (13 loc) • 412 B
JavaScript
const fs = require("fs")
const path = require("path")
function saveToFile(filename, content, format) {
const ext = path.extname(filename)
const safeFilename = ext ? filename : `${filename}.${format}`
try {
fs.writeFileSync(safeFilename, content)
} catch (err) {
console.error(`❌ Failed to save file: ${err.message}`)
process.exit(1)
}
}
module.exports = { saveToFile }