Skip to content

Commit

Permalink
doc: add example code for fs.existsSync()
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
nicolasrestrepo authored and targos committed Jul 2, 2019
1 parent 5047006 commit 818f084
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1701,6 +1701,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
Expand Down

0 comments on commit 818f084

Please sign in to comment.