fs.unwatchFile(filename[, listener])
-
listener
<Function> 可选,先前使用fs.watchFile()
附加的监听器。¥
listener
<Function> Optional, a listener previously attached usingfs.watchFile()
停止监视 filename
的变化。如果指定了 listener
,则仅删除该特定监听器。否则,所有监听器都将被删除,从而有效地停止对 filename
的监视。
¥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
.
使用未被监视的文件名调用 fs.unwatchFile()
是空操作,而不是错误。
¥Calling fs.unwatchFile()
with a filename that is not being watched is a
no-op, not an error.
使用 fs.watch()
比 fs.watchFile()
和 fs.unwatchFile()
更高效。应尽可能使用 fs.watch()
而不是 fs.watchFile()
和 fs.unwatchFile()
。
¥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.