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

doc,fs: update description of fs.stat() method #47654

Merged
merged 5 commits into from
Apr 23, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4126,6 +4126,10 @@ Asynchronous stat(2). The callback gets two arguments `(err, stats)` where

In case of an error, the `err.code` will be one of [Common System Errors][].

[`fs.stat()`][] follows symbolic links, [`fs.lstat()`][] looks at the links
mertcanaltin marked this conversation as resolved.
Show resolved Hide resolved
themselves. Therefore, it is recommended to use [`fs.lstat()`][] when the links
themselves need to be examined.
mertcanaltin marked this conversation as resolved.
Show resolved Hide resolved

Using `fs.stat()` to check for the existence of a file before calling
`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended.
Instead, user code should open/read/write the file directly and handle the
Expand Down