const fs = require("fs"); let text = "Something you want to write in"; fs.writeFileSync("document.txt", text, function(err){ if(err){ return console.log("error"); } })