fs.unwatchFile(filename[, listener])


停止监视 filename 的变化。 如果指定了 listener,则仅删除该特定监听器。 否则,所有监听器都将被删除,从而有效地停止监视 filename

使用未被监视的文件名调用 fs.unwatchFile() 是空操作,而不是错误。

使用 fs.watch()fs.watchFile()fs.unwatchFile() 更高效。 应尽可能使用 fs.watch() 而不是 fs.watchFile()fs.unwatchFile()

Stop watching for changes on filename. If listener is specified, only that particular listener is removed. Otherwise, all listeners are removed, effectively stopping watching of filename.

Calling fs.unwatchFile() with a filename that is not being watched is a no-op, not an error.

Using fs.watch() is more efficient than fs.watchFile() and fs.unwatchFile(). fs.watch() should be used instead of fs.watchFile() and fs.unwatchFile() when possible.