Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watch always fires rename event #9082

Closed
no1melman opened this issue Oct 13, 2016 · 3 comments
Closed

watch always fires rename event #9082

no1melman opened this issue Oct 13, 2016 · 3 comments
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. good first issue Issues that are suitable for first-time contributors. windows Issues and PRs related to the Windows platform.

Comments

@no1melman
Copy link

  • Version: v6.5.0
  • Platform: 64-bit Windows 10
  • Subsystem: fs

Running the below code, the eventType will always be rename whether I delete, add file...:

fs.watch(watchDir, (eventType, fileName) => {
    console.log(eventType);
});
@mscdex mscdex added fs Issues and PRs related to the fs subsystem / file system. windows Issues and PRs related to the Windows platform. labels Oct 13, 2016
@seishun
Copy link
Contributor

seishun commented Oct 13, 2016

'rename' is emitted whenever a filename appears or disappears. Maybe the docs could be a bit clearer about this.

@MylesBorins MylesBorins added doc Issues and PRs related to the documentations. good first issue Issues that are suitable for first-time contributors. labels Oct 13, 2016
@sonalbhadani496
Copy link

fs.watch , In different operating system this functionality is know by different names . This is not 100 percent consistent in Windows 10 os , thats why the event type is always renamed .
I have read this information from this link https://nodejs.org/api/all.html#fs_fs_watch_filename_options_listener .

@no1melman
Copy link
Author

@sonalbhadani496 that isn't quite true, the docs do state:

The fs.watch API is not 100% consistent across platforms, and is unavailable in some situations.

The eventType I see has this:

eventType is either 'rename' or 'change', and filename is the name of the file which triggered the event.

Which I agree could probably do with @seishun explanation along with it.

addaleax pushed a commit that referenced this issue Nov 22, 2016
'rename' is confusing, and it's not clear what "they" refers to.

Fixes: #9082
PR-URL: #9318
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
MylesBorins pushed a commit that referenced this issue Dec 21, 2016
'rename' is confusing, and it's not clear what "they" refers to.

Fixes: #9082
PR-URL: #9318
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
MylesBorins pushed a commit that referenced this issue Dec 21, 2016
'rename' is confusing, and it's not clear what "they" refers to.

Fixes: #9082
PR-URL: #9318
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. fs Issues and PRs related to the fs subsystem / file system. good first issue Issues that are suitable for first-time contributors. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants