监测文件更新

5年以前  |  阅读数:491 次  |  编程语言:JavaScript 

fs模块提供了fs.watch()方法,用以监测文件更新。

fs.watch(fileName, {
  persistent: true
}, function(event, filename) {
  console.log(event + " event occurred on " + filename)
})

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8