os-hostname
Platform aware tool to get the current hostname using environment variables and falls back to the system command hostname.
Last updated 5 years ago by leichtgewicht .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install os-hostname 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.1.3                                ...           latest (5 years ago)

5 Versions

  • 1.1.3                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 2
Last Day 0
Last Week 1
Last Month 2
Dependencies (1)
Dev Dependencies (2)

Copyright 2014 - 2016 © taobao.org |