userinfo

1.2.1 • Public • Published

userinfo

Current Version Build Status via Travis CI Dependencies devDependencies

Node.js native addon for working with user information

Methods

whoami()

  • 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.

getHomeDirectory()

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.

Command Line Interface (CLI)

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 - Invokes whoami()
  • H, getHomeDirectory - Invokes getHomeDirectory()

Readme

Keywords

Package Sidebar

Install

npm i userinfo

Weekly Downloads

16

Version

1.2.1

License

MIT

Last publish

Collaborators

  • cjihrig