aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authornicolasrestrepo <nicolasrestrepo34@gmail.com>2019-06-21 16:46:14 -0500
committerRich Trott <rtrott@gmail.com>2019-06-23 22:48:24 -0700
commitd4549e75d47f9824d080b9eac9b1a9e696634449 (patch)
tree3e0b6d7e288b834e14a8e8186b616be6402e3be9 /doc
parentc1ee66804c3605882410a7adfe7e44c7ad603b82 (diff)
downloadandroid-node-v8-d4549e75d47f9824d080b9eac9b1a9e696634449.tar.gz
android-node-v8-d4549e75d47f9824d080b9eac9b1a9e696634449.tar.bz2
android-node-v8-d4549e75d47f9824d080b9eac9b1a9e696634449.zip
doc: add example code for fs.existsSync()
PR-URL: https://github.com/nodejs/node/pull/28354 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/fs.md5
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 3b681ba397..83840ca0a6 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -1763,6 +1763,11 @@ this API: [`fs.exists()`][].
parameter to `fs.exists()` accepts parameters that are inconsistent with other
Node.js callbacks. `fs.existsSync()` does not use a callback.
+```js
+if (fs.existsSync('/etc/passwd')) {
+ console.log('The file exists.');
+}
+```
## fs.fchmod(fd, mode, callback)
<!-- YAML