Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix usage of folder and directory terms in fs.md #32919

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

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

Creates a unique temporary directory.

Expand All @@ -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
});
```
Expand All @@ -2571,19 +2571,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 @@ -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()`][].
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

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