Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73860ac

Browse files
tniessenmarco-ippolito
authored andcommitted
doc: clarify that fs.exists() may return false for existing symlink
Given that this API is problematic in any case, we should be preciseabout its (perhaps surprising) behavior.PR-URL:#53566Reviewed-By: Jithil P Ponnan <jithil@outlook.com>Reviewed-By: Moshe Atlow <moshe@atlow.co.il>Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>Reviewed-By: Luigi Pinca <luigipinca@gmail.com>Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
1 parentbcd08be commit73860ac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎doc/api/fs.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2656,7 +2656,7 @@ changes:
26562656
* `callback` {Function}
26572657
* `exists` {boolean}
26582658
2659-
Test whether or not the given path exists by checking with the file system.
2659+
Test whether or not theelement at thegiven`path` exists by checking with the file system.
26602660
Then call the `callback` argument with either true or false:
26612661
26622662
```mjs
@@ -2673,6 +2673,9 @@ parameter, optionally followed by other parameters. The `fs.exists()` callback
26732673
has only one boolean parameter. This is one reason `fs.access()` is recommended
26742674
instead of `fs.exists()`.
26752675
2676+
If `path` is a symbolic link, it is followed. Thus, if `path` exists but points
2677+
to a non-existent element, the callback will receive the value `false`.
2678+
26762679
Using `fs.exists()` to check for the existence of a file before calling
26772680
`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing
26782681
so introduces a race condition, since other processes may change the file's

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp