Skip to content

Commit

Permalink
doc: fix mkdtemp() documentation
Browse files Browse the repository at this point in the history
Several minor fixes to the entries for `mkdtemp()`. The most significant
is that a mistaken use of `fs.mkdtemp()` is corrected to
`fsPromises.mkdtemp()`.

PR-URL: #20512
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
  • Loading branch information
Trott authored and MylesBorins committed May 8, 2018
1 parent bf22f41 commit 1bead0f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2064,8 +2064,6 @@ 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.

Example:

```js
fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {
if (err) throw err;
Expand All @@ -2077,7 +2075,7 @@ fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {
The `fs.mkdtemp()` method will append the six randomly selected characters
directly to the `prefix` string. For instance, given a directory `/tmp`, if the
intention is to create a temporary directory *within* `/tmp`, the `prefix`
*must* end with a trailing platform-specific path separator
must end with a trailing platform-specific path separator
(`require('path').sep`).

```js
Expand Down Expand Up @@ -4003,24 +4001,22 @@ added: v10.0.0
* `encoding` {string} **Default:** `'utf8'`
* Returns: {Promise}

Creates a unique temporary directory then resolves the `Promise` with the
created folder path. A unique directory name is generated by appending six
random characters to the end of the provided `prefix`.
Creates a unique temporary directory and resolves the `Promise` with the created
folder path. A unique directory name is generated by appending six random
characters to the end of the provided `prefix`.

The optional `options` argument can be a string specifying an encoding, or an
object with an `encoding` property specifying the character encoding to use.

Example:

```js
fsPromises.mkdtemp(path.join(os.tmpdir(), 'foo-'))
.catch(console.error);
```

The `fs.mkdtemp()` method will append the six randomly selected characters
directly to the `prefix` string. For instance, given a directory `/tmp`, if the
intention is to create a temporary directory *within* `/tmp`, the `prefix`
*must* end with a trailing platform-specific path separator
The `fsPromises.mkdtemp()` method will append the six randomly selected
characters directly to the `prefix` string. For instance, given a directory
`/tmp`, if the intention is to create a temporary directory *within* `/tmp`, the
`prefix` must end with a trailing platform-specific path separator
(`require('path').sep`).

### fsPromises.open(path, flags[, mode])
Expand Down

0 comments on commit 1bead0f

Please sign in to comment.