Created
January 22, 2022 14:09
-
-
Save pemre/149a36d32405dc9e0f7cdc98ea1f5de9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO You may put them under an npm package one day... | |
// -------------------------------------------------- | |
const fs = require('fs'); | |
const deleteFile = (filename) => { | |
try { | |
fs.unlinkSync(filename); | |
} catch (err) { | |
throw Error(err); | |
} | |
}; | |
exports.deleteFile = deleteFile; | |
// -------------------------------------------------- | |
const fs = require('fs'); | |
const writeToFile = (filename, text) => { | |
fs.writeFileSync(filename, text, (err) => { | |
if (err) { | |
throw Error(err); | |
} | |
}); | |
}; | |
exports.writeToFile = writeToFile; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment