From 1f7a527f0461576b1d5e8d49a450268902a9947a Mon Sep 17 00:00:00 2001 From: Gaelan Date: Tue, 30 Apr 2019 16:12:46 -0700 Subject: [PATCH] doc: clarify behavior of fs.mkdir PR-URL: https://github.com/nodejs/node/pull/27505 Reviewed-By: Rich Trott Reviewed-By: James M Snell --- doc/api/fs.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 9e3b0df9a487b9..3b3c6efd58243f 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2206,7 +2206,9 @@ are given to the completion callback. The optional `options` argument can be an integer specifying mode (permission and sticky bits), or an object with a `mode` property and a `recursive` -property indicating whether parent folders should be created. +property indicating whether parent folders should be created. Calling +`fs.mkdir()` when `path` is a directory that exists results in an error only +when `recursive` is false. ```js // Creates /tmp/a/apple, regardless of whether `/tmp` and /tmp/a exist. @@ -4288,7 +4290,9 @@ arguments upon success. The optional `options` argument can be an integer specifying mode (permission and sticky bits), or an object with a `mode` property and a `recursive` -property indicating whether parent folders should be created. +property indicating whether parent folders should be created. Calling +`fsPromises.mkdir()` when `path` is a directory that exists results in a +rejection only when `recursive` is false. ### fsPromises.mkdtemp(prefix[, options])