Skip to content

Commit 1f7a527

Browse files
Gaelantargos
authored andcommitted
doc: clarify behavior of fs.mkdir
PR-URL: #27505 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent e61823c commit 1f7a527

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/api/fs.md

Lines changed: 6 additions & 2 deletions
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)