get-fqdn
v1.0.0
Published
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 v6.4+.
Downloads
5,864
Readme
get-fqdn
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/ |