os-hostname

1.1.3 • Public • Published

os-hostname Build Status

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.

Usage

Install with:

$ npm i os-hostname --save

and use it with:

var hostname = require('os-hostname')
hostname(function (err, hname) {
    console.log(hname)
})

cheers.

Caching & Invalidation

By default the user is cached for 10 minutes it is possible to invalidate the cache using:

user.invalidate()

License

ISC

first version extracted from osenv

Package Sidebar

Install

npm i os-hostname

Weekly Downloads

26

Version

1.1.3

License

ISC

Last publish

Collaborators

  • leichtgewicht