public-apis/utils/db/write-to-file.js
2022-11-18 18:51:59 +01:00

11 lines
246 B
JavaScript

const fs = require('fs')
module.exports = async function ({ data, filePath }) {
await fs.writeFile(filePath, data, error => {
if (error) {
throw new Error(`Error writing to file: ${error}`)
}
})
return
}