Commit 80155d3
fs: add the fs.mkdtemp() function.
This uses libuv's mkdtemp function to provide a way to create a
temporary folder, using a prefix as the path. The prefix is appended
six random characters. The callback function will receive the name
of the folder that was created.
Usage example:
fs.mkdtemp('/tmp/foo-', function(err, folder) {
console.log(folder);
// Prints: /tmp/foo-Tedi42
});
The fs.mkdtempSync version is also provided. Usage example:
console.log(fs.mkdtemp('/tmp/foo-'));
// Prints: tmp/foo-Tedi42
This pull request also includes the relevant documentation changes
and tests.
PR-URL: #5333
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 731f7b8 commit 80155d3Copy full SHA for 80155d3
File tree
Expand file treeCollapse file tree
4 files changed
+98
-0
lines changedOpen diff view settings
Filter options
- doc/api
- lib
- src
- test/parallel
Expand file treeCollapse file tree
4 files changed
+98
-0
lines changedOpen diff view settings
Collapse file
+24Lines changed: 24 additions & 0 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
532 | 532 | |
533 | 533 | |
534 | 534 | |
| 535 | + |
| 536 | + |
| 537 | + |
| 538 | + |
| 539 | + |
| 540 | + |
| 541 | + |
| 542 | + |
| 543 | + |
| 544 | + |
| 545 | + |
| 546 | + |
| 547 | + |
| 548 | + |
| 549 | + |
| 550 | + |
| 551 | + |
| 552 | + |
| 553 | + |
| 554 | + |
| 555 | + |
| 556 | + |
| 557 | + |
| 558 | + |
535 | 559 | |
536 | 560 | |
537 | 561 | |
|
Collapse file
+21Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
2078 | 2078 | |
2079 | 2079 | |
2080 | 2080 | |
| 2081 | + |
| 2082 | + |
| 2083 | + |
| 2084 | + |
| 2085 | + |
| 2086 | + |
| 2087 | + |
| 2088 | + |
| 2089 | + |
| 2090 | + |
| 2091 | + |
| 2092 | + |
| 2093 | + |
| 2094 | + |
| 2095 | + |
| 2096 | + |
| 2097 | + |
| 2098 | + |
| 2099 | + |
| 2100 | + |
| 2101 | + |
Collapse file
+26Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
200 | 200 | |
201 | 201 | |
202 | 202 | |
| 203 | + |
| 204 | + |
| 205 | + |
| 206 | + |
| 207 | + |
203 | 208 | |
204 | 209 | |
205 | 210 | |
| ||
1291 | 1296 | |
1292 | 1297 | |
1293 | 1298 | |
| 1299 | + |
| 1300 | + |
| 1301 | + |
| 1302 | + |
| 1303 | + |
| 1304 | + |
| 1305 | + |
| 1306 | + |
| 1307 | + |
| 1308 | + |
| 1309 | + |
| 1310 | + |
| 1311 | + |
| 1312 | + |
| 1313 | + |
| 1314 | + |
| 1315 | + |
| 1316 | + |
| 1317 | + |
1294 | 1318 | |
1295 | 1319 | |
1296 | 1320 | |
| ||
1344 | 1368 | |
1345 | 1369 | |
1346 | 1370 | |
| 1371 | + |
| 1372 | + |
1347 | 1373 | |
1348 | 1374 | |
1349 | 1375 | |
|
Collapse file
test/parallel/test-fs-mkdtemp.js
Copy file name to clipboard+27Lines changed: 27 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
0 commit comments