Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 818f084

Browse filesBrowse files
nicolasrestrepotargos
authored andcommitted
doc: add example code for fs.existsSync()
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>
1 parent 5047006 commit 818f084
Copy full SHA for 818f084

File tree

Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/fs.md‎

Copy file name to clipboardExpand all lines: doc/api/fs.md
+5Lines changed: 5 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,11 @@ this API: [`fs.exists()`][].
17011701
parameter to `fs.exists()` accepts parameters that are inconsistent with other
17021702
Node.js callbacks. `fs.existsSync()` does not use a callback.
17031703

1704+
```js
1705+
if (fs.existsSync('/etc/passwd')) {
1706+
console.log('The file exists.');
1707+
}
1708+
```
17041709

17051710
## fs.fchmod(fd, mode, callback)
17061711
<!-- YAML

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.