Works on OS X and Linux.
Instal
$ npm install --save passwd-user
Usage
var passwdUser = require('passwd-user');
passwdUser.sync('sindresorhus');
/*
{
username: 'sindresorhus',
password: '*',
uid: 501,
gid: 20,
fullname: 'Sindre Sorhus',
homedir: '/home/sindresorhus',
shell: '/bin/zsh'
}
*/
// or
passwdUser.sync(501);
// or
passwdUser.sync(process.getuid());
API
Accepts a username
or uid
number and returns an object with:
username
password
uid
: user IDgid
: group IDfullname
: name of userhomedir
: home directoryshell
: default shell
passwdUser(username | uid, callback)
passwdUser.sync(username | uid)
Related
username
- get the users username (cross-platform)fullname
- get the users fullname (cross-platform)
License
MIT © Sindre Sorhus