1const fs = require('fs');
2
3fs.writeFile("/tmp/test", "Hey there!", function(err) {
4 if(err) {
5 return console.log(err);
6 }
7 console.log("The file was saved!");
8});
9
10// Or
11fs.writeFileSync('/tmp/test-sync', 'Hey there!');