From 2f106c159b4e284b5220e6ac4564f27ee2cf16c1 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 This commit fixes the interchangeably usage of "folder" and "directory" terms in fs.md Fixes: https://github.com/nodejs/node/issues/32902 --- 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 af627f632b123e..f8db729ca69ffa 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2459,11 +2459,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. @@ -2509,7 +2509,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). @@ -2536,7 +2536,7 @@ changes: * `encoding` {string} **Default:** `'utf8'` * `callback` {Function} * `err` {Error} - * `folder` {string} + * `directory` {string} Creates a unique temporary directory. @@ -2546,16 +2546,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 }); ``` @@ -2571,9 +2571,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. @@ -2581,9 +2581,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. @@ -2600,7 +2600,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()`][]. @@ -3465,7 +3465,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 @@ -4972,11 +4972,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. @@ -4991,7 +4991,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