Skip to content

Commit 13d2df5

Browse files
GaelanTrott
authored andcommitted
doc: clarify behavior of fs.mkdir
PR-URL: #27505 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 5112b3d commit 13d2df5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/fs.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -2206,7 +2206,9 @@ are given to the completion callback.
22062206

22072207
The optional `options` argument can be an integer specifying mode (permission
22082208
and sticky bits), or an object with a `mode` property and a `recursive`
2209-
property indicating whether parent folders should be created.
2209+
property indicating whether parent folders should be created. Calling
2210+
`fs.mkdir()` when `path` is a directory that exists results in an error only
2211+
when `recursive` is false.
22102212

22112213
```js
22122214
// Creates /tmp/a/apple, regardless of whether `/tmp` and /tmp/a exist.
@@ -4288,7 +4290,9 @@ arguments upon success.
42884290

42894291
The optional `options` argument can be an integer specifying mode (permission
42904292
and sticky bits), or an object with a `mode` property and a `recursive`
4291-
property indicating whether parent folders should be created.
4293+
property indicating whether parent folders should be created. Calling
4294+
`fsPromises.mkdir()` when `path` is a directory that exists results in a
4295+
rejection only when `recursive` is false.
42924296

42934297
### fsPromises.mkdtemp(prefix[, options])
42944298
<!-- YAML

0 commit comments

Comments
 (0)