From 09ff9eafd911829a5e789d708468dd51a816e567 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 a331677469bd75..0623e1c5a9dacf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4126,6 +4126,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