注意事项
fs.watch
API 跨平台并非 100% 一致,并且在某些情况下不可用。
递归选项仅在 macOS 和 Windows 上受支持。
在 Windows 上,如果监视目录被移动或重命名,则不会触发任何事件。
删除监视目录时报 EPERM
错误。
The fs.watch
API is not 100% consistent across platforms, and is
unavailable in some situations.
The recursive option is only supported on macOS and Windows.
On Windows, no events will be emitted if the watched directory is moved or
renamed. An EPERM
error is reported when the watched directory is deleted.