Skip to content

fs.watch(): reports delete of file as change instead of rename #27869

@bpasero

Description

@bpasero
  • Version: 12.0.0
  • Platform: Darwin Benjamins-MacBook-Pro.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

Given the following code:

var fs = require("fs");

fs.watch('./test.txt', (event, filename) => {
    console.log(event, filename);
})

Running below in a directory where test.txt exists and gets deleted yields different results for event in 12.x vs 10.x:

  • 12.x: change
  • 10.x: rename

This basically renders node.js 12 incapable of detecting a file delete vs change when watching it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.fsIssues and PRs related to the fs subsystem / file system.libuvIssues and PRs related to the libuv dependency or the uv binding.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions