Adam Halasz
Adam Halasz

Reputation: 58341

Node.js: stable way to check for file changes?

Is there a stable way to check for file changes in node.js? I have tried the default fs.watch, but it is pretty buggy.

fs.watch(__dirname, function(event, filename){
    console.log(event + ' file ' + filename);
})

This logs a single change 3 times. And everyone is reporting a lots of bugs under different OS's.

node v0.8.21, Ubuntu 12.10

Upvotes: 1

Views: 284

Answers (1)

Munim
Munim

Reputation: 6520

If fs.watch is buggy, I'd just occasionally check the last modification stamp of a file to see if there are any updates using fs.stat

Upvotes: 3

Related Questions