Skip to content

Instantly share code, notes, and snippets.

@kybernetikos
Created May 8, 2012 20:50
Show Gist options
  • Save kybernetikos/2639159 to your computer and use it in GitHub Desktop.
Save kybernetikos/2639159 to your computer and use it in GitHub Desktop.
Make fs.watchFile work (kinda) on windows
var os = require('os');
if (os.platform() == 'win32') {
// change fs.watchFile so that it doesn't throw an error on windows.
fs.watchFile = function(filepath, callbackfunc) {
var old = fs.statSync(filepath);
fs.watch(filepath, function() {
fs.stat(filepath, function(err, newStat) {
callbackfunc(old, newStat);
});
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment