From 6bf0b00a3ddfc2896ff4d132a0a51c04814a305f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Sun, 23 Apr 2023 08:52:00 +0300 Subject: [PATCH] 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 Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca Reviewed-By: Daeyeon Jeong Reviewed-By: LiviaMedeiros --- doc/api/fs.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index b85bd039795834..4721364dedc4a6 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -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