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>
This commit is contained in:
parent
c1ee66804c
commit
d4549e75d4
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user