File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -3198,19 +3198,20 @@ Asynchronously creates a directory.
3198
3198
The callback is given a possible exception and, if `recursive` is `true`, the
3199
3199
first directory path created, `(err[, path])`.
3200
3200
`path` can still be `undefined` when `recursive` is `true`, if no directory was
3201
- created.
3201
+ created (for instance, if it was previously created) .
3202
3202
3203
3203
The optional `options` argument can be an integer specifying `mode` (permission
3204
3204
and sticky bits), or an object with a `mode` property and a `recursive`
3205
3205
property indicating whether parent directories should be created. Calling
3206
3206
`fs.mkdir()` when `path` is a directory that exists results in an error only
3207
- when `recursive` is false.
3207
+ when `recursive` is false. If `recursive` is false and the directory exists,
3208
+ an `EEXIST` error occurs.
3208
3209
3209
3210
```mjs
3210
3211
import { mkdir } from 'node:fs';
3211
3212
3212
- // Creates /tmp/a/apple, regardless of whether ` /tmp` and /tmp/a exist.
3213
- mkdir('/tmp/a/apple', { recursive: true }, (err) => {
3213
+ // Create . /tmp/a/apple, regardless of whether . /tmp and . /tmp/a exist.
3214
+ mkdir('. /tmp/a/apple', { recursive: true }, (err) => {
3214
3215
if (err) throw err;
3215
3216
});
3216
3217
```
You can’t perform that action at this time.
0 commit comments