Can it be said that fs promise writeFile and fs writeFileSync are the same thing? or rather, would behave the same way?
const fs = require('fs')
const fsProm = require ('fs').promises
//write file sync
fs.writeFileSync(filePath, data)
write file promise
fsProm.writeFile(filePath, data)
can any one please explain?
Also, fs promises writefile returns a promise, how do you check if the write was a success, and write a conditional statement based on that?
if (fsProm.writeFile === undefined) {
//do something
} else {
//do something else
}
how do i check if the operation was a success, and write a conditional statement based on that??