I have a little problem with node js.
If I save a file with fs.writeFile it saves but the file has no content, but if I read the file and print the content there is content in the file
Thats the node js code to save the file:
let sjson = JSON.parse(fs.readFileSync("./saves/User_VipList.json", "utf8"));
sjson['users'].push({"name": args[0]});
fs.writeFile("./saves/User_VipList.json", JSON.stringify(sjson), (err) => {
if(err) throw err;
});
Thats how i read the content:
let sjson = JSON.parse(fs.readFileSync("./saves/User_VipList.json", "utf8"));
console.log(sjson);
And that's the JSON file:
{
"users": []
}
But in users should be content because
Hope you guys can help me