简体   繁体   English

Node.js:检查文件更改的稳定方式?

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

Is there a stable way to check for file changes in node.js? 有没有一种稳定的方法来检查node.js中的文件更改? I have tried the default fs.watch , but it is pretty buggy. 我已经尝试过默认的fs.watch ,但它很漂亮。

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

This logs a single change 3 times. 这会记录3次单次更改。 And everyone is reporting a lots of bugs under different OS's. 每个人都在不同的操作系统下报告很多错误。

node v0.8.21, Ubuntu 12.10 节点v0.8.21,Ubuntu 12.10

如果fs.watch是错误的,我偶尔会检查一个文件的最后一个修改标记,看看是否有使用fs.stat任何更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM