Simple node.js util that returns the hostname of the current system if evaluable.
OTHER License
Simple node.js util that returns the hostname of the current system if evaluable.
On windows this util is aware of the domain using the COMPUTERNAME
environment variable.
On other systems it uses the HOSTNAME
environment variable.
If the environment variable is not given or empty on other systems it will fallback to hostname
which is also available on windows.
Install with:
$ npm i os-hostname --save
and use it with:
var hostname = require('os-hostname')
hostname(function (err, hname) {
console.log(hname)
})
cheers.
By default the user is cached for 10 minutes it is possible to invalidate the cache using:
user.invalidate()
first version extracted from osenv