File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 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.
31983198The callback is given a possible exception and, if `recursive` is `true`, the
31993199first directory path created, `(err[, path])`.
32003200`path` can still be `undefined` when `recursive` is `true`, if no directory was
3201- created.
3201+ created (for instance, if it was previously created) .
32023202
32033203The optional `options` argument can be an integer specifying `mode` (permission
32043204and sticky bits), or an object with a `mode` property and a `recursive`
32053205property indicating whether parent directories should be created. Calling
32063206`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.
32083209
32093210```mjs
32103211import { mkdir } from 'node:fs';
32113212
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) => {
32143215 if (err) throw err;
32153216});
32163217```
You can’t perform that action at this time.
0 commit comments