Skip to content
This repository has been archived by the owner on Feb 24, 2018. It is now read-only.
/ userinfo Public archive

Node.js native addon for working with user information

License

Notifications You must be signed in to change notification settings

cjihrig/userinfo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

userinfo

Current Version Build Status via Travis CI Dependencies

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()