Node.JS: How does “fs.watchFile” work?

前端 未结 2 990
青春惊慌失措
青春惊慌失措 2020-12-24 03:03

According to the API docs for Node 0.4.3, the fs.watchFile(filename, [options], listener) function starts a routine that will

Watch for c

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 03:52

    To extend on tjameson's fantastic answer, you could use watchr to normalise the API between the node versiosn and OS watching differences. It also provides events for unlink and new instead of just change, as well as adds support for directory tree watching.

提交回复
热议问题