From 02e870979e155e51a7d9a77f3558685930c625d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Fri, 21 Apr 2023 09:19:20 +0300 Subject: [PATCH 1/5] doc,fs: update description of fs.stat() method --- doc/api/fs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index a331677469bd75..a4385bd228220e 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -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 +themselves. Therefore, it is recommended to use [`fs.lstat()`][] when the links +themselves need to be examined. + 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 From cc9b271502a5a2a7cfc86e1ec069854646442050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Fri, 21 Apr 2023 09:51:05 +0300 Subject: [PATCH 2/5] Update doc/api/fs.md Co-authored-by: Darshan Sen --- doc/api/fs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index a4385bd228220e..0315e1c45c7deb 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4126,7 +4126,7 @@ 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 +[`fs.stat()`][] follows symbolic links. [`fs.lstat()`][] looks at the links themselves. Therefore, it is recommended to use [`fs.lstat()`][] when the links themselves need to be examined. From 3d9c6bd44122488aaa0485bd2530bfc3c9f8131a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Fri, 21 Apr 2023 09:51:11 +0300 Subject: [PATCH 3/5] Update doc/api/fs.md Co-authored-by: Darshan Sen --- doc/api/fs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 0315e1c45c7deb..e0fbd2aa0398cf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4127,8 +4127,8 @@ 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 -themselves. Therefore, it is recommended to use [`fs.lstat()`][] when the links -themselves need to be examined. +themselves. Therefore, [`fs.lstat()`][] must be used when the links themselves +need to be examined. Using `fs.stat()` to check for the existence of a file before calling `fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. From 6208ed81ae1cdb189b43991912b47c0a69a8b8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Fri, 21 Apr 2023 18:38:39 +0300 Subject: [PATCH 4/5] Update doc/api/fs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michaƫl Zasso --- doc/api/fs.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index e0fbd2aa0398cf..4104302eeac681 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4126,9 +4126,8 @@ 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 -themselves. Therefore, [`fs.lstat()`][] must be used when the links themselves -need to be examined. +[`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. From 7eb84ae628d22bb46f1fc4e759cd3bf728c49952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mert=20Can=20Alt=C4=B1n?= Date: Fri, 21 Apr 2023 18:57:25 +0300 Subject: [PATCH 5/5] lint --- doc/api/fs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 4104302eeac681..0623e1c5a9dacf 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -4126,8 +4126,8 @@ 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. +[`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.