doc: fix mkdtemp() documentation

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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Rich Trott 2018-05-03 21:51:03 -07:00
parent 17cb5ad2d2
commit 2d609c5d53

View File

@ -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;
@ -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
@ -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])