homedir

Return the current user's home directory.

Usage

var homedir = require( '@stdlib/os/homedir' );

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.

Notes

Examples

var homedir = require( '@stdlib/os/homedir' );

console.log( homedir() );

CLI

Usage

Usage: homedir [options]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Examples

$ homedir
e.g., /Users/<username>
Did you find this page helpful?