Platform agnostic user home directory path resolution (i.e. man 5 passwd
) for Node.js.
The user's home directory. This is the full path name where the user will be placed on login.
homedir();
#=> /Users/wilmoore
homedir('Guest');
#=> /Users/Guest
homedir();
#=> C:\Users\wilmoore
homedir('Public');
#=> C:\Users\Public
homedir();
#=> /home/wilmoore
homedir('guest');
#=> /home/guest
npm install homedir --save