索引节点


【Inodes】

在 Linux 和 macOS 系统上,fs.watch() 会解析路径到一个 索引节点 并监视 inode。如果被监视的路径被删除并重新创建,它会被分配一个新的 inode。监视会针对删除操作触发事件,但会继续监视_原始_ inode。新的 inode 不会触发事件。这是预期的行为。

【On Linux and macOS systems, fs.watch() resolves the path to an inode and watches the inode. If the watched path is deleted and recreated, it is assigned a new inode. The watch will emit an event for the delete but will continue watching the original inode. Events for the new inode will not be emitted. This is expected behavior.】

AIX 文件在文件的整个生命周期内保持相同的 inode。在 AIX 上保存并关闭被监视的文件会导致两个通知(一个用于添加新内容,另一个用于截断)。

【AIX files retain the same inode for the lifetime of a file. Saving and closing a watched file on AIX will result in two notifications (one for adding new content, and one for truncation).】