Skip to content

Commit b200152

Browse files
bzozStephen Belanger
authored and
Stephen Belanger
committed
doc: make mkdtemp example work on Windows
PR-URL: nodejs/node#15408 Fixes: nodejs/node#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 8ceb08a commit b200152

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/api/fs.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1536,10 +1536,10 @@ object with an `encoding` property specifying the character encoding to use.
15361536
Example:
15371537

15381538
```js
1539-
fs.mkdtemp('/tmp/foo-', (err, folder) => {
1539+
fs.mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, folder) => {
15401540
if (err) throw err;
15411541
console.log(folder);
1542-
// Prints: /tmp/foo-itXde2
1542+
// Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2
15431543
});
15441544
```
15451545

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

15521552
```js
15531553
// The parent directory for the new temporary directory
1554-
const tmpDir = '/tmp';
1554+
const tmpDir = os.tmpdir();
15551555

15561556
// This method is *INCORRECT*:
15571557
fs.mkdtemp(tmpDir, (err, folder) => {

0 commit comments

Comments
 (0)