I\'m trying to overwrite an existing file. I\'m first checking if the file exists using:
fs.existsSync(path)
If file does not exit I\'m cre
Found the solution. fs.writeFileSync gets a third arguments for options that can be an object. So if you get the "File already exist" you should do.
fs.writeFileSync(path,content,{encoding:'utf8',flag:'w'})