Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cryptoscamdb/graceful-dns

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cryptoscamdb/graceful-dns

An NPM package to provide non-rejecting promises for Node's DNS module

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

graceful-dns

Disclaimer

Are you writing code in dev environments? Check out the experimental DNS Promises API (added in v10.6.0)

Do you want promises to reject instead of returning undefined? Check out dns-then

This project wraps a part of Node.js's dns module in non-rejecting promises (instead of rejecting, it returns undefined. It also parses URLs to hostnames automatically. It's not a 1:1 port.

Usage

npm i -P @cryptoscamdb/graceful-dns

API

  • getServers() - returns an array of IP addresses which are configured for DNS lookups
  • setServers(servers) - configures an array of IP addresses which are configured for DNS lookups
  • getIP(hostname) - returns a promise which will resolve to either undefined or the IP address
  • getDNS(hostname) - returns a promise which will resolve to either undefined or an array of DNS records
  • getNS(hostname) - returns a promise which will resolve to either undefined or an array of nameservers
  • reverseDNS(ip) - returns a promise which will resolve to either undefined or an array of hostnames

Examples

import { getIP } from '@cryptoscamdb/graceful-dns';

getIP('example.com')
    .then((ip: string) => {
        if (ip) {
            console.log("Found IP:", ip);
        } else {
            console.log("Could not find IP address");
        }
    })
    .catch(() => {
        // This should never be called
    });

Keywords

FAQs

Package last updated on 30 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc