Answer the question
In order to leave comments, you need to log in
How to overwrite a file?
There is a json file. You need to completely replace its contents with [].
How can I do that?
Answer the question
In order to leave comments, you need to log in
const fs = require('fs');
fs.writeFile('./my.json', '[]', error => console.log("Done!"));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question