doc: make mkdtemp example work on Windows · nodejs/node@ab014d4

Original file line numberDiff line numberDiff line change

@@ -1133,10 +1133,10 @@ object with an `encoding` property specifying the character encoding to use.

11331133

Example:

11341134
11351135

```js

1136-

fs.mkdtemp('/tmp/foo-', (err, folder) => {

1136+

fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {

11371137

if (err) throw err;

11381138

console.log(folder);

1139-

// Prints: /tmp/foo-itXde2

1139+

// Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2

11401140

});

11411141

```

11421142

@@ -1148,7 +1148,7 @@ the `prefix` *must* end with a trailing platform-specific path separator

11481148
11491149

```js

11501150

// The parent directory for the new temporary directory

1151-

const tmpDir = '/tmp';

1151+

const tmpDir = os.tmpdir();

11521152
11531153

// This method is *INCORRECT*:

11541154

fs.mkdtemp(tmpDir, (err, folder) => {