Node.js native addon for working with user information
- Arguments
- None
- Returns
- string - The current username.
Returns the current username. Calls GetUserName()
on Windows, and getlogin_r()
otherwise. Throws if the username cannot be retrieved.
Deprecated - As of Node/io.js v2.3.0, os.homedir()
provides this functionality.
- Arguments
- None
- Returns
- string - The current user's home directory.
Returns the current user's home directory. Calls SHGetKnownFolderPath()
on Windows, and getlogin_r()
followed by getpwnam()
otherwise. Throws if the home directory cannot be retrieved. Currently, only the current user's home directory can be retrieved, due to Windows limitations.
userinfo functionality can be accessed via the command line. The CLI is available using the userinfo
command. The following command line arguments are valid:
w
,whoami
- Invokeswhoami()
H
,getHomeDirectory
- InvokesgetHomeDirectory()