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: include the optional options parameter #7842

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
20 changes: 18 additions & 2 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,16 @@ added: v0.1.21

Synchronous mkdir(2). Returns `undefined`.

## fs.mkdtemp(prefix, callback)
## fs.mkdtemp(prefix[, options], callback)
<!-- YAML
added: v5.10.0
-->

* `prefix` {String}
* `options` {String | Object}
* `encoding` {String} default = `'utf8'`
* `callback` {Function}

Creates a unique temporary directory.

Generates six random characters to be appended behind a required
Expand All @@ -898,10 +903,14 @@ Generates six random characters to be appended behind a required
The created folder 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.

Example:

```js
fs.mkdtemp('/tmp/foo-', (err, folder) => {
if (err) throw err;
console.log(folder);
// Prints: /tmp/foo-itXde2
});
Expand Down Expand Up @@ -938,14 +947,21 @@ fs.mkdtemp(tmpDir + path.sep, (err, folder) => {
});
```

## fs.mkdtempSync(prefix)
## fs.mkdtempSync(prefix[, options])
<!-- YAML
added: v5.10.0
-->

* `prefix` {String}
* `options` {String | Object}
* `encoding` {String} default = `'utf8'`

The synchronous version of [`fs.mkdtemp()`][]. Returns the created
folder path.

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

## fs.open(path, flags[, mode], callback)
<!-- YAML
added: v0.0.2
Expand Down