fs.watch( \'example.xml\', function ( curr, prev ) {
// on file change we can read the new xml
fs.readFile( \'example.xml\',\'utf8\', function ( err, data ) {
I suggest to work with chokidar
(https://github.com/paulmillr/chokidar) which is much better than fs.watch
:
Commenting its README.md:
Node.js fs.watch
:
rename
.Node.js fs.watchFile
: