Return the current user's home directory.
var homedir = require( '@stdlib/os/homedir' );Returns the current user's home directory.
var home = homedir();
// e.g., returns '/Users/<username>'If unable to locate a home directory, the function returns null.
- The implementation primarily checks various environment variables to locate a
homedirectory. Note that this approach has security vulnerabilities, as attackers can tamper with environment variables.
var homedir = require( '@stdlib/os/homedir' );
console.log( homedir() );Usage: homedir [options]
Options:
-h, --help Print this message.
-V, --version Print the package version.
$ homedir
e.g., /Users/<username>@stdlib/os/configdir: return a directory for user-specific configuration files.@stdlib/os/tmpdir: return the directory for storing temporary files.