GeezerVison is showing github.com — doc: add documentation about os.tmpdir() overrides · nodejs/node@5bfb4bc
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/os.md +13Lines changed: 13 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -416,6 +416,19 @@ changes: |
416 | 416 | Returns the operating system's default directory for temporary files as a |
417 | 417 | string. |
418 | 418 |
|
| 419 | +On Windows, the result can be overridden by `TEMP` and `TMP` environment variables, and |
| 420 | +`TEMP` takes precedence over `TMP`. If neither is set, it defaults to `%SystemRoot%\temp` |
| 421 | +or `%windir%\temp`. |
| 422 | + |
| 423 | +On non-Windows platforms, `TMPDIR`, `TMP` and `TEMP` environment variables will be checked |
| 424 | +to override the result of this method, in the described order. If none of them is set, it |
| 425 | +defaults to `/tmp`. |
| 426 | + |
| 427 | +Some operating system distributions would either configure `TMPDIR` (non-Windows) or |
| 428 | +`TEMP` and `TMP` (Windows) by default without additional configurations by the system |
| 429 | +administrators. The result of `os.tmpdir()` typically reflects the system preference |
| 430 | +unless it's explicitly overridden by the users. |
| 431 | + |
419 | 432 | ## `os.totalmem()` |
420 | 433 |
|
421 | 434 | <!-- YAML |
|