Skip to content

Commit 4a78fe5

Browse files
juanarboltargos
authored andcommitted
doc: improve os.homedir() docs
PR-URL: #28401 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 3f78a51 commit 4a78fe5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

doc/api/os.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ added: v2.3.0
215215
The `os.homedir()` method returns the home directory of the current user as a
216216
string.
217217

218+
**POSIX**:
219+
Will use the `$HOME` environment variable if defined. Otherwise, it will use
220+
the [effective UID][EUID] to look up the user's home directory.
221+
222+
**Windows**:
223+
Will use the `USERPROFILE` environment variable if defined. Otherwise it
224+
will be the path to the profile directory of the current user.
225+
218226
## os.hostname()
219227
<!-- YAML
220228
added: v0.3.3
@@ -1319,4 +1327,5 @@ The following process scheduling constants are exported by
13191327
[`process.arch`]: process.html#process_process_arch
13201328
[`process.platform`]: process.html#process_process_platform
13211329
[Android building]: https://github.com/nodejs/node/blob/master/BUILDING.md#androidandroid-based-devices-eg-firefox-os
1330+
[EUID]: https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID
13221331
[uname(3)]: https://linux.die.net/man/3/uname

0 commit comments

Comments
 (0)