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 Trott committed Jun 24, 2019
1 parent c1ee668 commit d4549e7
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 @@ -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
Expand Down

0 comments on commit d4549e7

Please sign in to comment.