Skip to content

Commit

Permalink
doc: make mkdtemp example work on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
bzoz committed Sep 14, 2017
1 parent cba206f commit ee7a261
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1536,10 +1536,11 @@ object with an `encoding` property specifying the character encoding to use.
Example:

```js
fs.mkdtemp('/tmp/foo-', (err, folder) => {
const tempFolder = process.platform === 'win32' ? process.env['TEMP'] : '/tmp';
fs.mkdtemp(path.join(tempFolder, 'foo-'), (err, folder) => {
if (err) throw err;
console.log(folder);
// Prints: /tmp/foo-itXde2
// Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2
});
```

Expand Down

0 comments on commit ee7a261

Please sign in to comment.