Created
July 2, 2013 06:28
-
-
Save amirkheirabadi73/5907150 to your computer and use it in GitHub Desktop.
Watch A File For Changes RealTime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require("fs"); | |
console.log("Read File ...."); | |
var conf = JSON.parse(fs.readFileSync("config.json")); | |
console.log("One : ", conf); | |
fs.watchFile("config.json", function(current,previous){ | |
console.log("File Changed ..."); | |
var conf = JSON.parse(fs.readFileSync("config.json")); | |
console.log("Two : " , conf); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment