Skip to content

Commit

Permalink
doc: fix usage of folder and directory terms in fs.md
Browse files Browse the repository at this point in the history
This commit fixes the interchangeably usage of "folder" and "directory"
terms in fs.md

Fixes: #32902

PR-URL: #32919
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Andrey Pechkurov <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
karan1205 authored and BridgeAR committed Apr 28, 2020
1 parent c596759 commit 76e960c
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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).
Expand All @@ -2547,7 +2547,7 @@ changes:
* `encoding` {string} **Default:** `'utf8'`
* `callback` {Function}
* `err` {Error}
* `folder` {string}
* `directory` {string}

Creates a unique temporary directory.

Expand All @@ -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
});
```
Expand All @@ -2582,19 +2582,19 @@ 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.
});

// 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.
Expand All @@ -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()`][].
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand All @@ -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
Expand Down

0 comments on commit 76e960c

Please sign in to comment.