Skip to content

Commit ab014d4

Browse files
bzozMylesBorins
authored andcommitted
doc: make mkdtemp example work on Windows
PR-URL: #15408 Fixes: #14960 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 0b5798b commit ab014d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/api/fs.md

Lines changed: 3 additions & 3 deletions
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) => {

0 commit comments

Comments
 (0)