Nodejs

No description

fork
loading
Files
  • index.js
  • helloworld.txt
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
var fs = require('fs');
function update() {
  console.log("Before: " + fs.readFileSync("helloworld.txt").toString());

  var myContent = "This text was written at " + (new Date().toGMTString());
  fs.writeFileSync('helloworld.txt', myContent);

  console.log("After:  " +fs.readFileSync("helloworld.txt").toString());
}


setInterval(update, 5000);
node v10.16.0