os-user
v2.1.4
Published
Platform aware tool to get the currently logged-in user evaluated using environment variables and falls back to whoami.
Downloads
15
Readme
os-user
Simple node.js util that returns the user currently running on the system.
On windows this util is aware of the domain using the USERDOMAIN
and USERNAME
variable.
On other systems it uses the USER
environment variable. If the USER
is not given or empty on other systems it will fallback to whoami
.
Usage
Install with:
$ npm i os-user --save
and use it with:
var user = require('os-user')
user(function (err, usr) {
console.log(usr)
})
cheers.
Caching & Invalidation
By default the user is cached for 10 minutes it is possible to invalidate the cache using:
user.invalidate()
License
first version extracted from osenv