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 creating and writing using:
fs.writeFileSync(path,string)
The problem is when the file already exists and I want to over write all its contents. Is there a single line solution, so far I searched and found solutions that use fs.truncate & fs.write, but is there a one hit solution?