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 <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • 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.