From 198b9696dd8bc17b5211b08b71a46fa4b7e9559e Mon Sep 17 00:00:00 2001 From: nicolasrestrepo Date: Fri, 21 Jun 2019 16:46:14 -0500 Subject: [PATCH] doc:add example function to fs.existsSync --- doc/api/fs.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 1c3742903affde..ff7b8f8bd5477f 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)