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

PR-URL: https://github.com/nodejs/node/pull/47654
Fixes: https://github.com/nodejs/node/issues/47633
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
This commit is contained in:
Mert Can Altın authored and Moshe Atlow committed 2023-07-07 00:06:07 +03:00
1 parent d4eecb5be9
commit 8651ea822e
1 file changed
+3
+3
View File
@@ -4066,6 +4066,9 @@ 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. Use [`fs.lstat()`][] to look at the
links themselves.
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