From 76e960c67f5bc1dbbb15ef40dd9619e54ba8071a Mon Sep 17 00:00:00 2001 From: karan singh virdi Date: Sun, 19 Apr 2020 01:32:54 +0530 Subject: [PATCH] doc: fix usage of folder and directory terms in fs.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the interchangeably usage of "folder" and "directory" terms in fs.md Fixes: https://github.com/nodejs/node/issues/32902 PR-URL: https://github.com/nodejs/node/pull/32919 Reviewed-By: Juan José Arboleda Reviewed-By: Andrey Pechkurov Reviewed-By: Colin Ihrig Reviewed-By: Zeyu Yang Reviewed-By: David Carlier Reviewed-By: Trivikram Kamat --- doc/api/fs.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index a7c07c6f9c1332..e9083e1aece48d 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2470,11 +2470,11 @@ changes: Asynchronously creates a directory. The callback is given a possible exception and, if `recursive` is `true`, the -first folder path created, `(err, [path])`. +first directory path created, `(err, [path])`. 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. Calling +property indicating whether parent directories should be created. Calling `fs.mkdir()` when `path` is a directory that exists results in an error only when `recursive` is false. @@ -2520,7 +2520,7 @@ changes: * Returns: {string|undefined} Synchronously creates a directory. Returns `undefined`, or if `recursive` is -`true`, the first folder path created. +`true`, the first directory path created. This is the synchronous version of [`fs.mkdir()`][]. See also: mkdir(2). @@ -2547,7 +2547,7 @@ changes: * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} * `err` {Error} - * `folder` {string} + * `directory` {string} Creates a unique temporary directory. @@ -2557,16 +2557,16 @@ inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, notably the BSDs, can return more than six random characters, and replace trailing `X` characters in `prefix` with random characters. -The created folder path is passed as a string to the callback's second +The created directory path is passed as a string to the callback's second parameter. The optional `options` argument can be a string specifying an encoding, or an object with an `encoding` property specifying the character encoding to use. ```js -fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => { +fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, directory) => { if (err) throw err; - console.log(folder); + console.log(directory); // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 }); ``` @@ -2582,9 +2582,9 @@ must end with a trailing platform-specific path separator const tmpDir = os.tmpdir(); // This method is *INCORRECT*: -fs.mkdtemp(tmpDir, (err, folder) => { +fs.mkdtemp(tmpDir, (err, directory) => { if (err) throw err; - console.log(folder); + console.log(directory); // Will print something similar to `/tmpabc123`. // A new temporary directory is created at the file system root // rather than *within* the /tmp directory. @@ -2592,9 +2592,9 @@ fs.mkdtemp(tmpDir, (err, folder) => { // This method is *CORRECT*: const { sep } = require('path'); -fs.mkdtemp(`${tmpDir}${sep}`, (err, folder) => { +fs.mkdtemp(`${tmpDir}${sep}`, (err, directory) => { if (err) throw err; - console.log(folder); + console.log(directory); // Will print something similar to `/tmp/abc123`. // A new temporary directory is created within // the /tmp directory. @@ -2611,7 +2611,7 @@ added: v5.10.0 * `encoding` {string} **Default:** `'utf8'` * Returns: {string} -Returns the created folder path. +Returns the created directory path. For detailed information, see the documentation of the asynchronous version of this API: [`fs.mkdtemp()`][]. @@ -3476,7 +3476,7 @@ error raised if the file is not available. To check if a file exists without manipulating it afterwards, [`fs.access()`][] is recommended. -For example, given the following folder structure: +For example, given the following directory structure: ```fundamental - txtDir @@ -4945,11 +4945,11 @@ added: v10.0.0 * Returns: {Promise} Asynchronously creates a directory then resolves the `Promise` with either no -arguments, or the first folder path created if `recursive` is `true`. +arguments, or the first directory path created if `recursive` is `true`. 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. Calling +property indicating whether parent directories should be created. Calling `fsPromises.mkdir()` when `path` is a directory that exists results in a rejection only when `recursive` is false. @@ -4964,7 +4964,7 @@ added: v10.0.0 * Returns: {Promise} Creates a unique temporary directory and resolves the `Promise` with the created -folder path. A unique directory name is generated by appending six random +directory path. A unique directory name is generated by appending six random characters to the end of the provided `prefix`. Due to platform inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, notably the BSDs, can return more than six random characters, and replace