Skip to content

Commit 1bead0f

Browse files
TrottMylesBorins
authored andcommitted
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: #20512 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Shingo Inoue <[email protected]>
1 parent bf22f41 commit 1bead0f

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

doc/api/fs.md

+8-12
Original file line numberDiff line numberDiff line change
@@ -2064,8 +2064,6 @@ parameter.
20642064
The optional `options` argument can be a string specifying an encoding, or an
20652065
object with an `encoding` property specifying the character encoding to use.
20662066

2067-
Example:
2068-
20692067
```js
20702068
fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {
20712069
if (err) throw err;
@@ -2077,7 +2075,7 @@ fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {
20772075
The `fs.mkdtemp()` method will append the six randomly selected characters
20782076
directly to the `prefix` string. For instance, given a directory `/tmp`, if the
20792077
intention is to create a temporary directory *within* `/tmp`, the `prefix`
2080-
*must* end with a trailing platform-specific path separator
2078+
must end with a trailing platform-specific path separator
20812079
(`require('path').sep`).
20822080

20832081
```js
@@ -4003,24 +4001,22 @@ added: v10.0.0
40034001
* `encoding` {string} **Default:** `'utf8'`
40044002
* Returns: {Promise}
40054003

4006-
Creates a unique temporary directory then resolves the `Promise` with the
4007-
created folder path. A unique directory name is generated by appending six
4008-
random characters to the end of the provided `prefix`.
4004+
Creates a unique temporary directory and resolves the `Promise` with the created
4005+
folder path. A unique directory name is generated by appending six random
4006+
characters to the end of the provided `prefix`.
40094007

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

4013-
Example:
4014-
40154011
```js
40164012
fsPromises.mkdtemp(path.join(os.tmpdir(), 'foo-'))
40174013
.catch(console.error);
40184014
```
40194015

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

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

0 commit comments

Comments
 (0)