get-fqdn

1.0.0 • Public • Published

get-fqdn

build status code style styled with prettier made with lass license npm downloads

Lookup the fully qualified domain name ("FQDN") of the current server's IP (default) or a custom IP. 90x faster than hostname -f and works with Node v14+.

Table of Contents

Install

npm:

npm install get-fqdn

Usage

const getFQDN = require('get-fqdn');

// async/await usage
(async () => {
  try {
    const fqdn = await getFQDN();
    console.log('fqdn', fqdn);
  } catch (err) {
    console.error(err);
  }
});

// then/catch usage
getFQDN().then(fqdn => console.log('fqdn', fqdn)).catch(console.error);

Note that you can also pass a custom IP:

const fqdn = await getFQDN('1.1.1.1');
console.log('fqdn', fqdn);

Performance

This package runs approximately 90x faster than the alternative of using hostname -f.

It was built to ensure that ForwardEmail.net is as optimized as possible.

Others packages were written in CoffeeScript, used deasync, or used the hostname -f approach (also see the fqdn package that uses the wrong approach too).

Contributors

Name Website
Nick Baugh http://niftylettuce.com/

License

MIT © Nick Baugh

/get-fqdn/

    Package Sidebar

    Install

    npm i get-fqdn

    Weekly Downloads

    701

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.69 kB

    Total Files

    4

    Last publish

    Collaborators

    • niftylettuce
    • titanism