diff --git a/doc/api/fs.md b/doc/api/fs.md index 2b9369ffa3b04c..3e2201cf6d44ed 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1517,6 +1517,16 @@ Asynchronous stat(2). The callback gets two arguments `(err, stats)` where `stats` is a [`fs.Stats`][] object. See the [`fs.Stats`][] section for more information. +In case of an error, the `err.code` will be one of [Common System Errors][]. + +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 +error raised if the file is not available. + +To check if a file exists without manipulating it afterwards, [`fs.access()`] +is recommended. + ## fs.statSync(path)