Skip to main content

dns

The node:dns module enables name resolution. For example, use it to look up IP addresses of host names.

Although named for the Domain Name System (DNS), it does not always use the DNS protocol for lookups. lookup uses the operating system facilities to perform name resolution. It may not need to perform any network communication. To perform name resolution the way other applications on the same system do, use lookup.

import dns from 'node:dns';

dns.lookup('example.org', (err, address, family) => {
  console.log('address: %j family: IPv%s', address, family);
});
// address: "93.184.216.34" family: IPv4

All other functions in the node:dns module connect to an actual DNS server to perform name resolution. They will always use the network to perform DNS queries. These functions do not use the same set of configuration files used by lookup (e.g. /etc/hosts). Use these functions to always perform DNS queries, bypassing other name-resolution facilities.

import dns from 'node:dns';

dns.resolve4('archive.org', (err, addresses) => {
  if (err) throw err;

  console.log(`addresses: ${JSON.stringify(addresses)}`);

  addresses.forEach((a) => {
    dns.reverse(a, (err, hostnames) => {
      if (err) {
        throw err;
      }
      console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`);
    });
  });
});

See the Implementation considerations section for more information.

Usage in Deno

import * as mod from "node:dns";

Functions

f
getDefaultResultOrder

Get the default value for order in lookup and dnsPromises.lookup(). The value could be:

    f
    getServers

    Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.

      f
      lookup

      Resolves a host name (e.g. 'nodejs.org') into the first found A (IPv4) or AAAA (IPv6) record. All option properties are optional. If options is an integer, then it must be 4 or 6 – if options is 0 or not provided, then IPv4 and IPv6 addresses are both returned if found.

        f
        lookupService

        Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

          f
          promises.getDefaultResultOrder

          Get the default value for verbatim in lookup and dnsPromises.lookup(). The value could be:

            f
            promises.getServers

            Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.

              f
              promises.lookup

              Resolves a host name (e.g. 'nodejs.org') into the first found A (IPv4) or AAAA (IPv6) record. All option properties are optional. If options is an integer, then it must be 4 or 6 – if options is not provided, then IPv4 and IPv6 addresses are both returned if found.

                f
                promises.lookupService

                Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

                  f
                  promises.resolve

                  Uses the DNS protocol to resolve a host name (e.g. 'nodejs.org') into an array of the resource records. When successful, the Promise is resolved with an array of resource records. The type and structure of individual results vary based on rrtype:

                    f
                    promises.resolve4

                    Uses the DNS protocol to resolve IPv4 addresses (A records) for the hostname. On success, the Promise is resolved with an array of IPv4 addresses (e.g. ['74.125.79.104', '74.125.79.105', '74.125.79.106']).

                      f
                      promises.resolve6

                      Uses the DNS protocol to resolve IPv6 addresses (AAAA records) for the hostname. On success, the Promise is resolved with an array of IPv6 addresses.

                        f
                        promises.resolveAny

                        Uses the DNS protocol to resolve all records (also known as ANY or * query). On success, the Promise is resolved with an array containing various types of records. Each object has a property type that indicates the type of the current record. And depending on the type, additional properties will be present on the object:

                          f
                          promises.resolveCaa

                          Uses the DNS protocol to resolve CAA records for the hostname. On success, the Promise is resolved with an array of objects containing available certification authority authorization records available for the hostname (e.g. [{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]).

                            f
                            promises.resolveCname

                            Uses the DNS protocol to resolve CNAME records for the hostname. On success, the Promise is resolved with an array of canonical name records available for the hostname (e.g. ['bar.example.com']).

                              f
                              promises.resolveMx

                              Uses the DNS protocol to resolve mail exchange records (MX records) for the hostname. On success, the Promise is resolved with an array of objects containing both a priority and exchange property (e.g.[{priority: 10, exchange: 'mx.example.com'}, ...]).

                                f
                                promises.resolveNaptr

                                Uses the DNS protocol to resolve regular expression-based records (NAPTR records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

                                  f
                                  promises.resolveNs

                                  Uses the DNS protocol to resolve name server records (NS records) for the hostname. On success, the Promise is resolved with an array of name server records available for hostname (e.g.['ns1.example.com', 'ns2.example.com']).

                                    f
                                    promises.resolvePtr

                                    Uses the DNS protocol to resolve pointer records (PTR records) for the hostname. On success, the Promise is resolved with an array of strings containing the reply records.

                                      f
                                      promises.resolveSoa

                                      Uses the DNS protocol to resolve a start of authority record (SOA record) for the hostname. On success, the Promise is resolved with an object with the following properties:

                                        f
                                        promises.resolveSrv

                                        Uses the DNS protocol to resolve service records (SRV records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

                                          f
                                          promises.resolveTxt

                                          Uses the DNS protocol to resolve text queries (TXT records) for the hostname. On success, the Promise is resolved with a two-dimensional array of the text records available for hostname (e.g.[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]). Each sub-array contains TXT chunks of one record. Depending on the use case, these could be either joined together or treated separately.

                                            f
                                            promises.reverse

                                            Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

                                              f
                                              promises.setDefaultResultOrder

                                              Set the default value of order in dns.lookup() and [lookup](/api/node/dns/. The value could be:

                                                f
                                                promises.setServers

                                                Sets the IP address and port of servers to be used when performing DNS resolution. The servers argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.

                                                  f
                                                  resolve
                                                  No documentation available
                                                    f
                                                    resolve4
                                                    No documentation available
                                                      f
                                                      resolve6
                                                      No documentation available
                                                        f
                                                        resolveAny
                                                        No documentation available
                                                          f
                                                          resolveCaa
                                                          No documentation available
                                                            f
                                                            resolveCname
                                                            No documentation available
                                                              f
                                                              resolveMx
                                                              No documentation available
                                                                f
                                                                resolveNaptr
                                                                No documentation available
                                                                  f
                                                                  resolveNs
                                                                  No documentation available
                                                                    f
                                                                    resolvePtr
                                                                    No documentation available
                                                                      f
                                                                      resolveSoa
                                                                      No documentation available
                                                                        f
                                                                        resolveSrv
                                                                        No documentation available
                                                                          f
                                                                          resolveTxt
                                                                          No documentation available
                                                                            f
                                                                            reverse

                                                                            Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

                                                                              f
                                                                              setDefaultResultOrder

                                                                              Set the default value of order in lookup and dnsPromises.lookup(). The value could be:

                                                                                f
                                                                                setServers

                                                                                Sets the IP address and port of servers to be used when performing DNS resolution. The servers argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.

                                                                                  Interfaces

                                                                                  I
                                                                                  AnyAaaaRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyARecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyCnameRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyMxRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyNaptrRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyNsRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyPtrRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnySoaRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnySrvRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  AnyTxtRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  LookupAddress
                                                                                  No documentation available
                                                                                  I
                                                                                  LookupAllOptions
                                                                                  No documentation available
                                                                                  I
                                                                                  LookupOneOptions
                                                                                  No documentation available
                                                                                  I
                                                                                  I
                                                                                  MxRecord
                                                                                  No documentation available
                                                                                  I
                                                                                  RecordWithTtl
                                                                                  No documentation available
                                                                                  I
                                                                                  ResolveOptions
                                                                                  No documentation available
                                                                                  I
                                                                                  ResolverOptions
                                                                                  No documentation available
                                                                                  I
                                                                                  ResolveWithTtlOptions
                                                                                  No documentation available
                                                                                  I
                                                                                  SrvRecord
                                                                                  No documentation available

                                                                                  Namespaces

                                                                                  N
                                                                                  promises

                                                                                  The dns.promises API provides an alternative set of asynchronous DNS methods that return Promise objects rather than using callbacks. The API is accessible via import { promises as dnsPromises } from 'node:dns' or import dnsPromises from 'node:dns/promises'.

                                                                                    Type Aliases

                                                                                    T
                                                                                    AnyRecord
                                                                                    No documentation available
                                                                                      T
                                                                                      AnyRecordWithTtl
                                                                                      No documentation available

                                                                                        Variables

                                                                                        v
                                                                                        ADDRCONFIG

                                                                                        Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are only returned if the current system has at least one IPv4 address configured.

                                                                                          v
                                                                                          ADDRGETNETWORKPARAMS
                                                                                          No documentation available
                                                                                            v
                                                                                            ALL

                                                                                            If dns.V4MAPPED is specified, return resolved IPv6 addresses as well as IPv4 mapped IPv6 addresses.

                                                                                              v
                                                                                              BADFAMILY
                                                                                              No documentation available
                                                                                                v
                                                                                                BADFLAGS
                                                                                                No documentation available
                                                                                                  v
                                                                                                  BADHINTS
                                                                                                  No documentation available
                                                                                                    v
                                                                                                    BADNAME
                                                                                                    No documentation available
                                                                                                      v
                                                                                                      BADQUERY
                                                                                                      No documentation available
                                                                                                        v
                                                                                                        BADRESP
                                                                                                        No documentation available
                                                                                                          v
                                                                                                          BADSTR
                                                                                                          No documentation available
                                                                                                            v
                                                                                                            CANCELLED
                                                                                                            No documentation available
                                                                                                              v
                                                                                                              CONNREFUSED
                                                                                                              No documentation available
                                                                                                                v
                                                                                                                DESTRUCTION
                                                                                                                No documentation available
                                                                                                                  v
                                                                                                                  EOF
                                                                                                                  No documentation available
                                                                                                                    v
                                                                                                                    FILE
                                                                                                                    No documentation available
                                                                                                                      v
                                                                                                                      FORMERR
                                                                                                                      No documentation available
                                                                                                                        v
                                                                                                                        LOADIPHLPAPI
                                                                                                                        No documentation available
                                                                                                                          v
                                                                                                                          NODATA
                                                                                                                          No documentation available
                                                                                                                            v
                                                                                                                            NOMEM
                                                                                                                            No documentation available
                                                                                                                              v
                                                                                                                              NONAME
                                                                                                                              No documentation available
                                                                                                                                v
                                                                                                                                NOTFOUND
                                                                                                                                No documentation available
                                                                                                                                  v
                                                                                                                                  NOTIMP
                                                                                                                                  No documentation available
                                                                                                                                    v
                                                                                                                                    NOTINITIALIZED
                                                                                                                                    No documentation available
                                                                                                                                      v
                                                                                                                                      promises.ADDRGETNETWORKPARAMS
                                                                                                                                      No documentation available
                                                                                                                                        v
                                                                                                                                        promises.BADFAMILY
                                                                                                                                        No documentation available
                                                                                                                                          v
                                                                                                                                          promises.BADFLAGS
                                                                                                                                          No documentation available
                                                                                                                                            v
                                                                                                                                            promises.BADHINTS
                                                                                                                                            No documentation available
                                                                                                                                              v
                                                                                                                                              promises.BADNAME
                                                                                                                                              No documentation available
                                                                                                                                                v
                                                                                                                                                promises.BADQUERY
                                                                                                                                                No documentation available
                                                                                                                                                  v
                                                                                                                                                  promises.BADRESP
                                                                                                                                                  No documentation available
                                                                                                                                                    v
                                                                                                                                                    promises.BADSTR
                                                                                                                                                    No documentation available
                                                                                                                                                      v
                                                                                                                                                      promises.CANCELLED
                                                                                                                                                      No documentation available
                                                                                                                                                        v
                                                                                                                                                        promises.CONNREFUSED
                                                                                                                                                        No documentation available
                                                                                                                                                          v
                                                                                                                                                          promises.DESTRUCTION
                                                                                                                                                          No documentation available
                                                                                                                                                            v
                                                                                                                                                            promises.EOF
                                                                                                                                                            No documentation available
                                                                                                                                                              v
                                                                                                                                                              promises.FILE
                                                                                                                                                              No documentation available
                                                                                                                                                                v
                                                                                                                                                                promises.FORMERR
                                                                                                                                                                No documentation available
                                                                                                                                                                  v
                                                                                                                                                                  promises.LOADIPHLPAPI
                                                                                                                                                                  No documentation available
                                                                                                                                                                    v
                                                                                                                                                                    promises.NODATA
                                                                                                                                                                    No documentation available
                                                                                                                                                                      v
                                                                                                                                                                      promises.NOMEM
                                                                                                                                                                      No documentation available
                                                                                                                                                                        v
                                                                                                                                                                        promises.NONAME
                                                                                                                                                                        No documentation available
                                                                                                                                                                          v
                                                                                                                                                                          promises.NOTFOUND
                                                                                                                                                                          No documentation available
                                                                                                                                                                            v
                                                                                                                                                                            promises.NOTIMP
                                                                                                                                                                            No documentation available
                                                                                                                                                                              v
                                                                                                                                                                              promises.NOTINITIALIZED
                                                                                                                                                                              No documentation available
                                                                                                                                                                                v
                                                                                                                                                                                promises.REFUSED
                                                                                                                                                                                No documentation available
                                                                                                                                                                                  v
                                                                                                                                                                                  promises.SERVFAIL
                                                                                                                                                                                  No documentation available
                                                                                                                                                                                    v
                                                                                                                                                                                    promises.TIMEOUT
                                                                                                                                                                                    No documentation available
                                                                                                                                                                                      v
                                                                                                                                                                                      REFUSED
                                                                                                                                                                                      No documentation available
                                                                                                                                                                                        v
                                                                                                                                                                                        SERVFAIL
                                                                                                                                                                                        No documentation available
                                                                                                                                                                                          v
                                                                                                                                                                                          TIMEOUT
                                                                                                                                                                                          No documentation available
                                                                                                                                                                                            v
                                                                                                                                                                                            V4MAPPED

                                                                                                                                                                                            If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported on some operating systems (e.g. FreeBSD 10.1).


                                                                                                                                                                                              class promises.Resolver

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { Resolver } = promises;
                                                                                                                                                                                              

                                                                                                                                                                                              An independent resolver for DNS requests.

                                                                                                                                                                                              Creating a new resolver uses the default server settings. Setting the servers used for a resolver using resolver.setServers() does not affect other resolvers:

                                                                                                                                                                                              import { promises } from 'node:dns';
                                                                                                                                                                                              const resolver = new promises.Resolver();
                                                                                                                                                                                              resolver.setServers(['4.4.4.4']);
                                                                                                                                                                                              
                                                                                                                                                                                              // This request will use the server at 4.4.4.4, independent of global settings.
                                                                                                                                                                                              resolver.resolve4('example.org').then((addresses) => {
                                                                                                                                                                                                // ...
                                                                                                                                                                                              });
                                                                                                                                                                                              
                                                                                                                                                                                              // Alternatively, the same code can be written using async-await style.
                                                                                                                                                                                              (async function() {
                                                                                                                                                                                                const addresses = await resolver.resolve4('example.org');
                                                                                                                                                                                              })();
                                                                                                                                                                                              

                                                                                                                                                                                              The following methods from the dnsPromises API are available:

                                                                                                                                                                                              • resolver.getServers()
                                                                                                                                                                                              • resolver.resolve()
                                                                                                                                                                                              • resolver.resolve4()
                                                                                                                                                                                              • resolver.resolve6()
                                                                                                                                                                                              • resolver.resolveAny()
                                                                                                                                                                                              • resolver.resolveCaa()
                                                                                                                                                                                              • resolver.resolveCname()
                                                                                                                                                                                              • resolver.resolveMx()
                                                                                                                                                                                              • resolver.resolveNaptr()
                                                                                                                                                                                              • resolver.resolveNs()
                                                                                                                                                                                              • resolver.resolvePtr()
                                                                                                                                                                                              • resolver.resolveSoa()
                                                                                                                                                                                              • resolver.resolveSrv()
                                                                                                                                                                                              • resolver.resolveTxt()
                                                                                                                                                                                              • resolver.reverse()
                                                                                                                                                                                              • resolver.setServers()

                                                                                                                                                                                              Constructors #

                                                                                                                                                                                              #Resolver(options?: ResolverOptions)
                                                                                                                                                                                              new

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              Methods #

                                                                                                                                                                                              #cancel(): void

                                                                                                                                                                                              Cancel all outstanding DNS queries made by this resolver. The corresponding callbacks will be called with an error with code ECANCELLED.

                                                                                                                                                                                              #setLocalAddress(
                                                                                                                                                                                              ipv4?: string,
                                                                                                                                                                                              ipv6?: string,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              The resolver instance will send its requests from the specified IP address. This allows programs to specify outbound interfaces when used on multi-homed systems.

                                                                                                                                                                                              If a v4 or v6 address is not specified, it is set to the default and the operating system will choose a local address automatically.

                                                                                                                                                                                              The resolver will use the v4 local address when making requests to IPv4 DNS servers, and the v6 local address when making requests to IPv6 DNS servers. The rrtype of resolution requests has no impact on the local address used.


                                                                                                                                                                                              class Resolver

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { Resolver } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              An independent resolver for DNS requests.

                                                                                                                                                                                              Creating a new resolver uses the default server settings. Setting the servers used for a resolver using resolver.setServers() does not affect other resolvers:

                                                                                                                                                                                              import { Resolver } from 'node:dns';
                                                                                                                                                                                              const resolver = new Resolver();
                                                                                                                                                                                              resolver.setServers(['4.4.4.4']);
                                                                                                                                                                                              
                                                                                                                                                                                              // This request will use the server at 4.4.4.4, independent of global settings.
                                                                                                                                                                                              resolver.resolve4('example.org', (err, addresses) => {
                                                                                                                                                                                                // ...
                                                                                                                                                                                              });
                                                                                                                                                                                              

                                                                                                                                                                                              The following methods from the node:dns module are available:

                                                                                                                                                                                              • resolver.getServers()
                                                                                                                                                                                              • resolver.resolve()
                                                                                                                                                                                              • resolver.resolve4()
                                                                                                                                                                                              • resolver.resolve6()
                                                                                                                                                                                              • resolver.resolveAny()
                                                                                                                                                                                              • resolver.resolveCaa()
                                                                                                                                                                                              • resolver.resolveCname()
                                                                                                                                                                                              • resolver.resolveMx()
                                                                                                                                                                                              • resolver.resolveNaptr()
                                                                                                                                                                                              • resolver.resolveNs()
                                                                                                                                                                                              • resolver.resolvePtr()
                                                                                                                                                                                              • resolver.resolveSoa()
                                                                                                                                                                                              • resolver.resolveSrv()
                                                                                                                                                                                              • resolver.resolveTxt()
                                                                                                                                                                                              • resolver.reverse()
                                                                                                                                                                                              • resolver.setServers()

                                                                                                                                                                                              Constructors #

                                                                                                                                                                                              #Resolver(options?: ResolverOptions)
                                                                                                                                                                                              new

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              Methods #

                                                                                                                                                                                              #cancel(): void

                                                                                                                                                                                              Cancel all outstanding DNS queries made by this resolver. The corresponding callbacks will be called with an error with code ECANCELLED.

                                                                                                                                                                                              #setLocalAddress(
                                                                                                                                                                                              ipv4?: string,
                                                                                                                                                                                              ipv6?: string,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              The resolver instance will send its requests from the specified IP address. This allows programs to specify outbound interfaces when used on multi-homed systems.

                                                                                                                                                                                              If a v4 or v6 address is not specified, it is set to the default and the operating system will choose a local address automatically.

                                                                                                                                                                                              The resolver will use the v4 local address when making requests to IPv4 DNS servers, and the v6 local address when making requests to IPv6 DNS servers. The rrtype of resolution requests has no impact on the local address used.


                                                                                                                                                                                              function getDefaultResultOrder

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { getDefaultResultOrder } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #getDefaultResultOrder():
                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"

                                                                                                                                                                                              Get the default value for order in lookup and dnsPromises.lookup(). The value could be:

                                                                                                                                                                                              • ipv4first: for order defaulting to ipv4first.
                                                                                                                                                                                              • ipv6first: for order defaulting to ipv6first.
                                                                                                                                                                                              • verbatim: for order defaulting to verbatim.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"

                                                                                                                                                                                              function getServers

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { getServers } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #getServers(): string[]

                                                                                                                                                                                              Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.

                                                                                                                                                                                              [
                                                                                                                                                                                                '4.4.4.4',
                                                                                                                                                                                                '2001:4860:4860::8888',
                                                                                                                                                                                                '4.4.4.4:1053',
                                                                                                                                                                                                '[2001:4860:4860::8888]:1053',
                                                                                                                                                                                              ]
                                                                                                                                                                                              

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              string[]

                                                                                                                                                                                              function lookup

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { lookup } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Resolves a host name (e.g. 'nodejs.org') into the first found A (IPv4) or AAAA (IPv6) record. All option properties are optional. If options is an integer, then it must be 4 or 6 – if options is 0 or not provided, then IPv4 and IPv6 addresses are both returned if found.

                                                                                                                                                                                              With the all option set to true, the arguments for callback change to (err, addresses), with addresses being an array of objects with the properties address and family.

                                                                                                                                                                                              On error, err is an Error object, where err.code is the error code. Keep in mind that err.code will be set to 'ENOTFOUND' not only when the host name does not exist but also when the lookup fails in other ways such as no available file descriptors.

                                                                                                                                                                                              dns.lookup() does not necessarily have anything to do with the DNS protocol. The implementation uses an operating system facility that can associate names with addresses and vice versa. This implementation can have subtle but important consequences on the behavior of any Node.js program. Please take some time to consult the Implementation considerations section before using dns.lookup().

                                                                                                                                                                                              Example usage:

                                                                                                                                                                                              import dns from 'node:dns';
                                                                                                                                                                                              const options = {
                                                                                                                                                                                                family: 6,
                                                                                                                                                                                                hints: dns.ADDRCONFIG | dns.V4MAPPED,
                                                                                                                                                                                              };
                                                                                                                                                                                              dns.lookup('example.com', options, (err, address, family) =>
                                                                                                                                                                                                console.log('address: %j family: IPv%s', address, family));
                                                                                                                                                                                              // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
                                                                                                                                                                                              
                                                                                                                                                                                              // When options.all is true, the result will be an Array.
                                                                                                                                                                                              options.all = true;
                                                                                                                                                                                              dns.lookup('example.com', options, (err, addresses) =>
                                                                                                                                                                                                console.log('addresses: %j', addresses));
                                                                                                                                                                                              // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
                                                                                                                                                                                              

                                                                                                                                                                                              If this method is invoked as its util.promisify() ed version, and all is not set to true, it returns a Promise for an Object with address and family properties.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #family: number
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: LookupAddress[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: LookupAddress[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 4

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              options: LookupOptions,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string | LookupAddress[],
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #options: LookupOptions
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string | LookupAddress[],
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 5

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function lookupService

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { lookupService } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #lookupService(
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              port: number,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              service: string,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

                                                                                                                                                                                              If address is not a valid IP address, a TypeError will be thrown. The port will be coerced to a number. If it is not a legal port, a TypeError will be thrown.

                                                                                                                                                                                              On an error, err is an Error object, where err.code is the error code.

                                                                                                                                                                                              import dns from 'node:dns';
                                                                                                                                                                                              dns.lookupService('127.0.0.1', 22, (err, hostname, service) => {
                                                                                                                                                                                                console.log(hostname, service);
                                                                                                                                                                                                // Prints: localhost ssh
                                                                                                                                                                                              });
                                                                                                                                                                                              

                                                                                                                                                                                              If this method is invoked as its util.promisify() ed version, it returns a Promise for an Object with hostname and service properties.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #address: string
                                                                                                                                                                                              #port: number
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              service: string,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function promises.getDefaultResultOrder

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { getDefaultResultOrder } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #getDefaultResultOrder(): "ipv4first" | "verbatim"

                                                                                                                                                                                              Get the default value for verbatim in lookup and dnsPromises.lookup(). The value could be:

                                                                                                                                                                                              • ipv4first: for verbatim defaulting to false.
                                                                                                                                                                                              • verbatim: for verbatim defaulting to true.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              "ipv4first" | "verbatim"

                                                                                                                                                                                              function promises.getServers

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { getServers } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #getServers(): string[]

                                                                                                                                                                                              Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.

                                                                                                                                                                                              [
                                                                                                                                                                                                '4.4.4.4',
                                                                                                                                                                                                '2001:4860:4860::8888',
                                                                                                                                                                                                '4.4.4.4:1053',
                                                                                                                                                                                                '[2001:4860:4860::8888]:1053',
                                                                                                                                                                                              ]
                                                                                                                                                                                              

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              string[]

                                                                                                                                                                                              function promises.lookup

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { lookup } = promises;
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              family: number,
                                                                                                                                                                                              ): Promise<LookupAddress>

                                                                                                                                                                                              Resolves a host name (e.g. 'nodejs.org') into the first found A (IPv4) or AAAA (IPv6) record. All option properties are optional. If options is an integer, then it must be 4 or 6 – if options is not provided, then IPv4 and IPv6 addresses are both returned if found.

                                                                                                                                                                                              With the all option set to true, the Promise is resolved with addresses being an array of objects with the properties address and family.

                                                                                                                                                                                              On error, the Promise is rejected with an Error object, where err.code is the error code. Keep in mind that err.code will be set to 'ENOTFOUND' not only when the host name does not exist but also when the lookup fails in other ways such as no available file descriptors.

                                                                                                                                                                                              dnsPromises.lookup() does not necessarily have anything to do with the DNS protocol. The implementation uses an operating system facility that can associate names with addresses and vice versa. This implementation can have subtle but important consequences on the behavior of any Node.js program. Please take some time to consult the Implementation considerations section before using dnsPromises.lookup().

                                                                                                                                                                                              Example usage:

                                                                                                                                                                                              import dns from 'node:dns';
                                                                                                                                                                                              const dnsPromises = dns.promises;
                                                                                                                                                                                              const options = {
                                                                                                                                                                                                family: 6,
                                                                                                                                                                                                hints: dns.ADDRCONFIG | dns.V4MAPPED,
                                                                                                                                                                                              };
                                                                                                                                                                                              
                                                                                                                                                                                              dnsPromises.lookup('example.com', options).then((result) => {
                                                                                                                                                                                                console.log('address: %j family: IPv%s', result.address, result.family);
                                                                                                                                                                                                // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
                                                                                                                                                                                              });
                                                                                                                                                                                              
                                                                                                                                                                                              // When options.all is true, the result will be an Array.
                                                                                                                                                                                              options.all = true;
                                                                                                                                                                                              dnsPromises.lookup('example.com', options).then((result) => {
                                                                                                                                                                                                console.log('addresses: %j', result);
                                                                                                                                                                                                // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}]
                                                                                                                                                                                              });
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #family: number

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<LookupAddress>

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              ): Promise<LookupAddress>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<LookupAddress>

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              ): Promise<LookupAddress[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<LookupAddress[]>

                                                                                                                                                                                              Overload 4

                                                                                                                                                                                              #lookup(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              options: LookupOptions,
                                                                                                                                                                                              ): Promise<LookupAddress | LookupAddress[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #options: LookupOptions

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Overload 5

                                                                                                                                                                                              #lookup(hostname: string): Promise<LookupAddress>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<LookupAddress>

                                                                                                                                                                                              function promises.lookupService

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { lookupService } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #lookupService(
                                                                                                                                                                                              address: string,
                                                                                                                                                                                              port: number,
                                                                                                                                                                                              ): Promise<{ hostname: string; service: string; }>

                                                                                                                                                                                              Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

                                                                                                                                                                                              If address is not a valid IP address, a TypeError will be thrown. The port will be coerced to a number. If it is not a legal port, a TypeError will be thrown.

                                                                                                                                                                                              On error, the Promise is rejected with an Error object, where err.code is the error code.

                                                                                                                                                                                              import dnsPromises from 'node:dns';
                                                                                                                                                                                              dnsPromises.lookupService('127.0.0.1', 22).then((result) => {
                                                                                                                                                                                                console.log(result.hostname, result.service);
                                                                                                                                                                                                // Prints: localhost ssh
                                                                                                                                                                                              });
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #address: string
                                                                                                                                                                                              #port: number

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<{ hostname: string; service: string; }>

                                                                                                                                                                                              function promises.resolve

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolve } = promises;
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #resolve(hostname: string): Promise<string[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve a host name (e.g. 'nodejs.org') into an array of the resource records. When successful, the Promise is resolved with an array of resource records. The type and structure of individual results vary based on rrtype:

                                                                                                                                                                                              On error, the Promise is rejected with an Error object, where err.code is one of the DNS error codes.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Host name to resolve.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "A",
                                                                                                                                                                                              ): Promise<string[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "A"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "AAAA",
                                                                                                                                                                                              ): Promise<string[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "AAAA"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 4

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "ANY",
                                                                                                                                                                                              ): Promise<AnyRecord[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "ANY"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<AnyRecord[]>

                                                                                                                                                                                              Overload 5

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "CAA",
                                                                                                                                                                                              ): Promise<CaaRecord[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "CAA"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<CaaRecord[]>

                                                                                                                                                                                              Overload 6

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "CNAME",
                                                                                                                                                                                              ): Promise<string[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "CNAME"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 7

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "MX",
                                                                                                                                                                                              ): Promise<MxRecord[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "MX"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<MxRecord[]>

                                                                                                                                                                                              Overload 8

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "NAPTR",
                                                                                                                                                                                              ): Promise<NaptrRecord[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "NAPTR"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<NaptrRecord[]>

                                                                                                                                                                                              Overload 9

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "NS",
                                                                                                                                                                                              ): Promise<string[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "NS"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 10

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "PTR",
                                                                                                                                                                                              ): Promise<string[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "PTR"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 11

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "SOA",
                                                                                                                                                                                              ): Promise<SoaRecord>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "SOA"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<SoaRecord>

                                                                                                                                                                                              Overload 12

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "SRV",
                                                                                                                                                                                              ): Promise<SrvRecord[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "SRV"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<SrvRecord[]>

                                                                                                                                                                                              Overload 13

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "TXT",
                                                                                                                                                                                              ): Promise<string[][]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "TXT"

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[][]>

                                                                                                                                                                                              Overload 14

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: string,
                                                                                                                                                                                              ): Promise<
                                                                                                                                                                                              string[]
                                                                                                                                                                                              | MxRecord[]
                                                                                                                                                                                              | NaptrRecord[]
                                                                                                                                                                                              | SoaRecord
                                                                                                                                                                                              | SrvRecord[]
                                                                                                                                                                                              | string[][]
                                                                                                                                                                                              | AnyRecord[]
                                                                                                                                                                                              >

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<
                                                                                                                                                                                              string[]
                                                                                                                                                                                              | MxRecord[]
                                                                                                                                                                                              | NaptrRecord[]
                                                                                                                                                                                              | SoaRecord
                                                                                                                                                                                              | SrvRecord[]
                                                                                                                                                                                              | string[][]
                                                                                                                                                                                              | AnyRecord[]
                                                                                                                                                                                              >

                                                                                                                                                                                              function promises.resolve4

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolve4 } = promises;
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #resolve4(hostname: string): Promise<string[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve IPv4 addresses (A records) for the hostname. On success, the Promise is resolved with an array of IPv4 addresses (e.g. ['74.125.79.104', '74.125.79.105', '74.125.79.106']).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Host name to resolve.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #resolve4(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              ): Promise<RecordWithTtl[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<RecordWithTtl[]>

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #resolve4(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              options: ResolveOptions,
                                                                                                                                                                                              ): Promise<string[] | RecordWithTtl[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #options: ResolveOptions

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[] | RecordWithTtl[]>

                                                                                                                                                                                              function promises.resolve6

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolve6 } = promises;
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #resolve6(hostname: string): Promise<string[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve IPv6 addresses (AAAA records) for the hostname. On success, the Promise is resolved with an array of IPv6 addresses.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Host name to resolve.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #resolve6(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              ): Promise<RecordWithTtl[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<RecordWithTtl[]>

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #resolve6(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              options: ResolveOptions,
                                                                                                                                                                                              ): Promise<string[] | RecordWithTtl[]>

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #options: ResolveOptions

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[] | RecordWithTtl[]>

                                                                                                                                                                                              function promises.resolveAny

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveAny } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveAny(hostname: string): Promise<AnyRecord[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve all records (also known as ANY or * query). On success, the Promise is resolved with an array containing various types of records. Each object has a property type that indicates the type of the current record. And depending on the type, additional properties will be present on the object:

                                                                                                                                                                                              Here is an example of the result object:

                                                                                                                                                                                              [ { type: 'A', address: '127.0.0.1', ttl: 299 },
                                                                                                                                                                                                { type: 'CNAME', value: 'example.com' },
                                                                                                                                                                                                { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
                                                                                                                                                                                                { type: 'NS', value: 'ns1.example.com' },
                                                                                                                                                                                                { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
                                                                                                                                                                                                { type: 'SOA',
                                                                                                                                                                                                  nsname: 'ns1.example.com',
                                                                                                                                                                                                  hostmaster: 'admin.example.com',
                                                                                                                                                                                                  serial: 156696742,
                                                                                                                                                                                                  refresh: 900,
                                                                                                                                                                                                  retry: 900,
                                                                                                                                                                                                  expire: 1800,
                                                                                                                                                                                                  minttl: 60 } ]
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<AnyRecord[]>

                                                                                                                                                                                              function promises.resolveCaa

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveCaa } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveCaa(hostname: string): Promise<CaaRecord[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve CAA records for the hostname. On success, the Promise is resolved with an array of objects containing available certification authority authorization records available for the hostname (e.g. [{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<CaaRecord[]>

                                                                                                                                                                                              function promises.resolveCname

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveCname } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveCname(hostname: string): Promise<string[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve CNAME records for the hostname. On success, the Promise is resolved with an array of canonical name records available for the hostname (e.g. ['bar.example.com']).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              function promises.resolveMx

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveMx } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveMx(hostname: string): Promise<MxRecord[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve mail exchange records (MX records) for the hostname. On success, the Promise is resolved with an array of objects containing both a priority and exchange property (e.g.[{priority: 10, exchange: 'mx.example.com'}, ...]).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<MxRecord[]>

                                                                                                                                                                                              function promises.resolveNaptr

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveNaptr } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveNaptr(hostname: string): Promise<NaptrRecord[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve regular expression-based records (NAPTR records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

                                                                                                                                                                                              • flags
                                                                                                                                                                                              • service
                                                                                                                                                                                              • regexp
                                                                                                                                                                                              • replacement
                                                                                                                                                                                              • order
                                                                                                                                                                                              • preference
                                                                                                                                                                                              {
                                                                                                                                                                                                flags: 's',
                                                                                                                                                                                                service: 'SIP+D2U',
                                                                                                                                                                                                regexp: '',
                                                                                                                                                                                                replacement: '_sip._udp.example.com',
                                                                                                                                                                                                order: 30,
                                                                                                                                                                                                preference: 100
                                                                                                                                                                                              }
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<NaptrRecord[]>

                                                                                                                                                                                              function promises.resolveNs

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveNs } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveNs(hostname: string): Promise<string[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve name server records (NS records) for the hostname. On success, the Promise is resolved with an array of name server records available for hostname (e.g.['ns1.example.com', 'ns2.example.com']).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              function promises.resolvePtr

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolvePtr } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolvePtr(hostname: string): Promise<string[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve pointer records (PTR records) for the hostname. On success, the Promise is resolved with an array of strings containing the reply records.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              function promises.resolveSoa

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveSoa } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveSoa(hostname: string): Promise<SoaRecord>

                                                                                                                                                                                              Uses the DNS protocol to resolve a start of authority record (SOA record) for the hostname. On success, the Promise is resolved with an object with the following properties:

                                                                                                                                                                                              • nsname
                                                                                                                                                                                              • hostmaster
                                                                                                                                                                                              • serial
                                                                                                                                                                                              • refresh
                                                                                                                                                                                              • retry
                                                                                                                                                                                              • expire
                                                                                                                                                                                              • minttl
                                                                                                                                                                                              {
                                                                                                                                                                                                nsname: 'ns.example.com',
                                                                                                                                                                                                hostmaster: 'root.example.com',
                                                                                                                                                                                                serial: 2013101809,
                                                                                                                                                                                                refresh: 10000,
                                                                                                                                                                                                retry: 2400,
                                                                                                                                                                                                expire: 604800,
                                                                                                                                                                                                minttl: 3600
                                                                                                                                                                                              }
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<SoaRecord>

                                                                                                                                                                                              function promises.resolveSrv

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveSrv } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveSrv(hostname: string): Promise<SrvRecord[]>

                                                                                                                                                                                              Uses the DNS protocol to resolve service records (SRV records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

                                                                                                                                                                                              • priority
                                                                                                                                                                                              • weight
                                                                                                                                                                                              • port
                                                                                                                                                                                              • name
                                                                                                                                                                                              {
                                                                                                                                                                                                priority: 10,
                                                                                                                                                                                                weight: 5,
                                                                                                                                                                                                port: 21223,
                                                                                                                                                                                                name: 'service.example.com'
                                                                                                                                                                                              }
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<SrvRecord[]>

                                                                                                                                                                                              function promises.resolveTxt

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { resolveTxt } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveTxt(hostname: string): Promise<string[][]>

                                                                                                                                                                                              Uses the DNS protocol to resolve text queries (TXT records) for the hostname. On success, the Promise is resolved with a two-dimensional array of the text records available for hostname (e.g.[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]). Each sub-array contains TXT chunks of one record. Depending on the use case, these could be either joined together or treated separately.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[][]>

                                                                                                                                                                                              function promises.reverse

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { reverse } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #reverse(ip: string): Promise<string[]>

                                                                                                                                                                                              Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

                                                                                                                                                                                              On error, the Promise is rejected with an Error object, where err.code is one of the DNS error codes.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #ip: string

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              Promise<string[]>

                                                                                                                                                                                              function promises.setDefaultResultOrder

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { setDefaultResultOrder } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #setDefaultResultOrder(order:
                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Set the default value of order in dns.lookup() and [lookup](/api/node/dns/#promises. The value could be:

                                                                                                                                                                                              • ipv4first: sets default order to ipv4first.
                                                                                                                                                                                              • ipv6first: sets default order to ipv6first.
                                                                                                                                                                                              • verbatim: sets default order to verbatim.

                                                                                                                                                                                              The default is verbatim and dnsPromises.setDefaultResultOrder() have higher priority than --dns-result-order. When using worker threads, dnsPromises.setDefaultResultOrder() from the main thread won't affect the default dns orders in workers.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #order:
                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"

                                                                                                                                                                                              must be 'ipv4first', 'ipv6first' or 'verbatim'.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function promises.setServers

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              const { setServers } = promises;
                                                                                                                                                                                              
                                                                                                                                                                                              #setServers(servers: readonly string[]): void

                                                                                                                                                                                              Sets the IP address and port of servers to be used when performing DNS resolution. The servers argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.

                                                                                                                                                                                              dnsPromises.setServers([
                                                                                                                                                                                                '4.4.4.4',
                                                                                                                                                                                                '[2001:4860:4860::8888]',
                                                                                                                                                                                                '4.4.4.4:1053',
                                                                                                                                                                                                '[2001:4860:4860::8888]:1053',
                                                                                                                                                                                              ]);
                                                                                                                                                                                              

                                                                                                                                                                                              An error will be thrown if an invalid address is provided.

                                                                                                                                                                                              The dnsPromises.setServers() method must not be called while a DNS query is in progress.

                                                                                                                                                                                              This method works much like resolve.conf. That is, if attempting to resolve with the first server provided results in a NOTFOUND error, the resolve() method will not attempt to resolve with subsequent servers provided. Fallback DNS servers will only be used if the earlier ones time out or result in some other error.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #servers: readonly string[]

                                                                                                                                                                                              array of RFC 5952 formatted addresses

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolve

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolve } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve a host name (e.g. 'nodejs.org') into an array of the resource records. The callback function has arguments (err, records). When successful, records will be an array of resource records. The type and structure of individual results varies based on rrtype:

                                                                                                                                                                                              On error, err is an Error object, where err.code is one of the DNS error codes.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Host name to resolve.

                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "A",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "A"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "AAAA",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "AAAA"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 4

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "ANY",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: AnyRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "ANY"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: AnyRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 5

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "CNAME",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "CNAME"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 6

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "MX",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: MxRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "MX"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: MxRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 7

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "NAPTR",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: NaptrRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "NAPTR"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: NaptrRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 8

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "NS",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "NS"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 9

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "PTR",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "PTR"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 10

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "SOA",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: SoaRecord,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "SOA"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: SoaRecord,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 11

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "SRV",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: SrvRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "SRV"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: SrvRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 12

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: "TXT",
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[][],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: "TXT"
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[][],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 13

                                                                                                                                                                                              #resolve(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              rrtype: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses:
                                                                                                                                                                                              string[]
                                                                                                                                                                                              | MxRecord[]
                                                                                                                                                                                              | NaptrRecord[]
                                                                                                                                                                                              | SoaRecord
                                                                                                                                                                                              | SrvRecord[]
                                                                                                                                                                                              | string[][]
                                                                                                                                                                                              | AnyRecord[]
                                                                                                                                                                                              ,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #rrtype: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses:
                                                                                                                                                                                              string[]
                                                                                                                                                                                              | MxRecord[]
                                                                                                                                                                                              | NaptrRecord[]
                                                                                                                                                                                              | SoaRecord
                                                                                                                                                                                              | SrvRecord[]
                                                                                                                                                                                              | string[][]
                                                                                                                                                                                              | AnyRecord[]
                                                                                                                                                                                              ,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolve4

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolve4 } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #resolve4(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve a IPv4 addresses (A records) for the hostname. The addresses argument passed to the callback function will contain an array of IPv4 addresses (e.g.['74.125.79.104', '74.125.79.105', '74.125.79.106']).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Host name to resolve.

                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #resolve4(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: RecordWithTtl[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: RecordWithTtl[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #resolve4(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              options: ResolveOptions,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[] | RecordWithTtl[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #options: ResolveOptions
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[] | RecordWithTtl[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolve6

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolve6 } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Overload 1

                                                                                                                                                                                              #resolve6(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve IPv6 addresses (AAAA records) for the hostname. The addresses argument passed to the callback function will contain an array of IPv6 addresses.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string

                                                                                                                                                                                              Host name to resolve.

                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 2

                                                                                                                                                                                              #resolve6(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: RecordWithTtl[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: RecordWithTtl[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              Overload 3

                                                                                                                                                                                              #resolve6(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              options: ResolveOptions,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[] | RecordWithTtl[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #options: ResolveOptions
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[] | RecordWithTtl[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveAny

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveAny } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveAny(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: AnyRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve all records (also known as ANY or * query). The ret argument passed to the callback function will be an array containing various types of records. Each object has a property type that indicates the type of the current record. And depending on the type, additional properties will be present on the object:

                                                                                                                                                                                              Here is an example of the ret object passed to the callback:

                                                                                                                                                                                              [ { type: 'A', address: '127.0.0.1', ttl: 299 },
                                                                                                                                                                                                { type: 'CNAME', value: 'example.com' },
                                                                                                                                                                                                { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 },
                                                                                                                                                                                                { type: 'NS', value: 'ns1.example.com' },
                                                                                                                                                                                                { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] },
                                                                                                                                                                                                { type: 'SOA',
                                                                                                                                                                                                  nsname: 'ns1.example.com',
                                                                                                                                                                                                  hostmaster: 'admin.example.com',
                                                                                                                                                                                                  serial: 156696742,
                                                                                                                                                                                                  refresh: 900,
                                                                                                                                                                                                  retry: 900,
                                                                                                                                                                                                  expire: 1800,
                                                                                                                                                                                                  minttl: 60 } ]
                                                                                                                                                                                              

                                                                                                                                                                                              DNS server operators may choose not to respond to ANY queries. It may be better to call individual methods like resolve4, resolveMx, and so on. For more details, see RFC 8482.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: AnyRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveCaa

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveCaa } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveCaa(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              records: CaaRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve CAA records for the hostname. The addresses argument passed to the callback function will contain an array of certification authority authorization records available for the hostname (e.g. [{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              records: CaaRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveCname

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveCname } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveCname(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve CNAME records for the hostname. The addresses argument passed to the callback function will contain an array of canonical name records available for the hostname (e.g. ['bar.example.com']).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveMx

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveMx } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveMx(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: MxRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve mail exchange records (MX records) for the hostname. The addresses argument passed to the callback function will contain an array of objects containing both a priority and exchange property (e.g. [{priority: 10, exchange: 'mx.example.com'}, ...]).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: MxRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveNaptr

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveNaptr } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveNaptr(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: NaptrRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve regular expression-based records (NAPTR records) for the hostname. The addresses argument passed to the callback function will contain an array of objects with the following properties:

                                                                                                                                                                                              • flags
                                                                                                                                                                                              • service
                                                                                                                                                                                              • regexp
                                                                                                                                                                                              • replacement
                                                                                                                                                                                              • order
                                                                                                                                                                                              • preference
                                                                                                                                                                                              {
                                                                                                                                                                                                flags: 's',
                                                                                                                                                                                                service: 'SIP+D2U',
                                                                                                                                                                                                regexp: '',
                                                                                                                                                                                                replacement: '_sip._udp.example.com',
                                                                                                                                                                                                order: 30,
                                                                                                                                                                                                preference: 100
                                                                                                                                                                                              }
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: NaptrRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveNs

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveNs } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveNs(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve name server records (NS records) for the hostname. The addresses argument passed to the callback function will contain an array of name server records available for hostname (e.g. ['ns1.example.com', 'ns2.example.com']).

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolvePtr

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolvePtr } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolvePtr(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve pointer records (PTR records) for the hostname. The addresses argument passed to the callback function will be an array of strings containing the reply records.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveSoa

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveSoa } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveSoa(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: SoaRecord,
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve a start of authority record (SOA record) for the hostname. The address argument passed to the callback function will be an object with the following properties:

                                                                                                                                                                                              • nsname
                                                                                                                                                                                              • hostmaster
                                                                                                                                                                                              • serial
                                                                                                                                                                                              • refresh
                                                                                                                                                                                              • retry
                                                                                                                                                                                              • expire
                                                                                                                                                                                              • minttl
                                                                                                                                                                                              {
                                                                                                                                                                                                nsname: 'ns.example.com',
                                                                                                                                                                                                hostmaster: 'root.example.com',
                                                                                                                                                                                                serial: 2013101809,
                                                                                                                                                                                                refresh: 10000,
                                                                                                                                                                                                retry: 2400,
                                                                                                                                                                                                expire: 604800,
                                                                                                                                                                                                minttl: 3600
                                                                                                                                                                                              }
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              address: SoaRecord,
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveSrv

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveSrv } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveSrv(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: SrvRecord[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve service records (SRV records) for the hostname. The addresses argument passed to the callback function will be an array of objects with the following properties:

                                                                                                                                                                                              • priority
                                                                                                                                                                                              • weight
                                                                                                                                                                                              • port
                                                                                                                                                                                              • name
                                                                                                                                                                                              {
                                                                                                                                                                                                priority: 10,
                                                                                                                                                                                                weight: 5,
                                                                                                                                                                                                port: 21223,
                                                                                                                                                                                                name: 'service.example.com'
                                                                                                                                                                                              }
                                                                                                                                                                                              

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: SrvRecord[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function resolveTxt

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { resolveTxt } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #resolveTxt(
                                                                                                                                                                                              hostname: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[][],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Deno compatibility

                                                                                                                                                                                              The ttl option is not supported.

                                                                                                                                                                                              Uses the DNS protocol to resolve text queries (TXT records) for the hostname. The records argument passed to the callback function is a two-dimensional array of the text records available for hostname (e.g.[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]). Each sub-array contains TXT chunks of one record. Depending on the use case, these could be either joined together or treated separately.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #hostname: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              addresses: string[][],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function reverse

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { reverse } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #reverse(
                                                                                                                                                                                              ip: string,
                                                                                                                                                                                              callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              hostnames: string[],
                                                                                                                                                                                              ) => void
                                                                                                                                                                                              ,
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

                                                                                                                                                                                              On error, err is an Error object, where err.code is one of the DNS error codes.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #ip: string
                                                                                                                                                                                              #callback: (
                                                                                                                                                                                              err: ErrnoException | null,
                                                                                                                                                                                              hostnames: string[],
                                                                                                                                                                                              ) => void

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function setDefaultResultOrder

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { setDefaultResultOrder } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #setDefaultResultOrder(order:
                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"
                                                                                                                                                                                              ): void

                                                                                                                                                                                              Set the default value of order in lookup and dnsPromises.lookup(). The value could be:

                                                                                                                                                                                              • ipv4first: sets default order to ipv4first.
                                                                                                                                                                                              • ipv6first: sets default order to ipv6first.
                                                                                                                                                                                              • verbatim: sets default order to verbatim.

                                                                                                                                                                                              The default is verbatim and setDefaultResultOrder have higher priority than --dns-result-order. When using worker threads, setDefaultResultOrder from the main thread won't affect the default dns orders in workers.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #order:
                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"

                                                                                                                                                                                              must be 'ipv4first', 'ipv6first' or 'verbatim'.

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void

                                                                                                                                                                                              function setServers

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { setServers } from "node:dns";
                                                                                                                                                                                              
                                                                                                                                                                                              #setServers(servers: readonly string[]): void

                                                                                                                                                                                              Sets the IP address and port of servers to be used when performing DNS resolution. The servers argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.

                                                                                                                                                                                              dns.setServers([
                                                                                                                                                                                                '4.4.4.4',
                                                                                                                                                                                                '[2001:4860:4860::8888]',
                                                                                                                                                                                                '4.4.4.4:1053',
                                                                                                                                                                                                '[2001:4860:4860::8888]:1053',
                                                                                                                                                                                              ]);
                                                                                                                                                                                              

                                                                                                                                                                                              An error will be thrown if an invalid address is provided.

                                                                                                                                                                                              The dns.setServers() method must not be called while a DNS query is in progress.

                                                                                                                                                                                              The setServers method affects only resolve, dns.resolve*() and reverse (and specifically not lookup).

                                                                                                                                                                                              This method works much like resolve.conf. That is, if attempting to resolve with the first server provided results in a NOTFOUND error, the resolve() method will not attempt to resolve with subsequent servers provided. Fallback DNS servers will only be used if the earlier ones time out or result in some other error.

                                                                                                                                                                                              Parameters #

                                                                                                                                                                                              #servers: readonly string[]

                                                                                                                                                                                              array of RFC 5952 formatted addresses

                                                                                                                                                                                              Return Type #

                                                                                                                                                                                              void






                                                                                                                                                                                              interface AnyNsRecord

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { type AnyNsRecord } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              #type: "NS"
                                                                                                                                                                                              #value: string

                                                                                                                                                                                              interface AnyPtrRecord

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { type AnyPtrRecord } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              #type: "PTR"
                                                                                                                                                                                              #value: string





                                                                                                                                                                                              interface LookupAddress

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { type LookupAddress } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              #address: string

                                                                                                                                                                                              A string representation of an IPv4 or IPv6 address.

                                                                                                                                                                                              #family: number

                                                                                                                                                                                              4 or 6, denoting the family of address, or 0 if the address is not an IPv4 or IPv6 address. 0 is a likely indicator of a bug in the name resolution service used by the operating system.




                                                                                                                                                                                              interface LookupOptions

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { type LookupOptions } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              #family:
                                                                                                                                                                                              number
                                                                                                                                                                                              | "IPv4"
                                                                                                                                                                                              | "IPv6"
                                                                                                                                                                                              | undefined
                                                                                                                                                                                              optional

                                                                                                                                                                                              The record family. Must be 4, 6, or 0. For backward compatibility reasons, 'IPv4' and 'IPv6' are interpreted as 4 and 6 respectively. The value 0 indicates that either an IPv4 or IPv6 address is returned. If the value 0 is used with { all: true } (see below), both IPv4 and IPv6 addresses are returned.

                                                                                                                                                                                              #hints: number | undefined
                                                                                                                                                                                              optional

                                                                                                                                                                                              One or more supported getaddrinfo flags. Multiple flags may be passed by bitwise ORing their values.

                                                                                                                                                                                              #all: boolean | undefined
                                                                                                                                                                                              optional

                                                                                                                                                                                              When true, the callback returns all resolved addresses in an array. Otherwise, returns a single address.

                                                                                                                                                                                              #order:
                                                                                                                                                                                              "ipv4first"
                                                                                                                                                                                              | "ipv6first"
                                                                                                                                                                                              | "verbatim"
                                                                                                                                                                                              | undefined
                                                                                                                                                                                              optional

                                                                                                                                                                                              When verbatim, the resolved addresses are return unsorted. When ipv4first, the resolved addresses are sorted by placing IPv4 addresses before IPv6 addresses. When ipv6first, the resolved addresses are sorted by placing IPv6 addresses before IPv4 addresses. Default value is configurable using setDefaultResultOrder or --dns-result-order.

                                                                                                                                                                                              #verbatim: boolean | undefined
                                                                                                                                                                                              deprecated
                                                                                                                                                                                              optional

                                                                                                                                                                                              When true, the callback receives IPv4 and IPv6 addresses in the order the DNS resolver returned them. When false, IPv4 addresses are placed before IPv6 addresses. This option will be deprecated in favor of order. When both are specified, order has higher precedence. New code should only use order. Default value is configurable using setDefaultResultOrder





                                                                                                                                                                                              interface ResolveOptions

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { type ResolveOptions } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              #ttl: boolean

                                                                                                                                                                                              interface ResolverOptions

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { type ResolverOptions } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              Properties #

                                                                                                                                                                                              #timeout: number | undefined
                                                                                                                                                                                              optional

                                                                                                                                                                                              Query timeout in milliseconds, or -1 to use the default timeout.

                                                                                                                                                                                              #tries: number
                                                                                                                                                                                              optional

                                                                                                                                                                                              The number of tries the resolver will try contacting each name server before giving up.





                                                                                                                                                                                              namespace promises

                                                                                                                                                                                              Usage in Deno

                                                                                                                                                                                              import { promises } from "node:dns";
                                                                                                                                                                                              

                                                                                                                                                                                              The dns.promises API provides an alternative set of asynchronous DNS methods that return Promise objects rather than using callbacks. The API is accessible via import { promises as dnsPromises } from 'node:dns' or import dnsPromises from 'node:dns/promises'.

                                                                                                                                                                                              Classes #

                                                                                                                                                                                              Functions #

                                                                                                                                                                                              f
                                                                                                                                                                                              promises.getDefaultResultOrder

                                                                                                                                                                                              Get the default value for verbatim in lookup and dnsPromises.lookup(). The value could be:

                                                                                                                                                                                                f
                                                                                                                                                                                                promises.getServers

                                                                                                                                                                                                Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution. A string will include a port section if a custom port is used.

                                                                                                                                                                                                  f
                                                                                                                                                                                                  promises.lookup

                                                                                                                                                                                                  Resolves a host name (e.g. 'nodejs.org') into the first found A (IPv4) or AAAA (IPv6) record. All option properties are optional. If options is an integer, then it must be 4 or 6 – if options is not provided, then IPv4 and IPv6 addresses are both returned if found.

                                                                                                                                                                                                    f
                                                                                                                                                                                                    promises.lookupService

                                                                                                                                                                                                    Resolves the given address and port into a host name and service using the operating system's underlying getnameinfo implementation.

                                                                                                                                                                                                      f
                                                                                                                                                                                                      promises.resolve

                                                                                                                                                                                                      Uses the DNS protocol to resolve a host name (e.g. 'nodejs.org') into an array of the resource records. When successful, the Promise is resolved with an array of resource records. The type and structure of individual results vary based on rrtype:

                                                                                                                                                                                                        f
                                                                                                                                                                                                        promises.resolve4

                                                                                                                                                                                                        Uses the DNS protocol to resolve IPv4 addresses (A records) for the hostname. On success, the Promise is resolved with an array of IPv4 addresses (e.g. ['74.125.79.104', '74.125.79.105', '74.125.79.106']).

                                                                                                                                                                                                          f
                                                                                                                                                                                                          promises.resolve6

                                                                                                                                                                                                          Uses the DNS protocol to resolve IPv6 addresses (AAAA records) for the hostname. On success, the Promise is resolved with an array of IPv6 addresses.

                                                                                                                                                                                                            f
                                                                                                                                                                                                            promises.resolveAny

                                                                                                                                                                                                            Uses the DNS protocol to resolve all records (also known as ANY or * query). On success, the Promise is resolved with an array containing various types of records. Each object has a property type that indicates the type of the current record. And depending on the type, additional properties will be present on the object:

                                                                                                                                                                                                              f
                                                                                                                                                                                                              promises.resolveCaa

                                                                                                                                                                                                              Uses the DNS protocol to resolve CAA records for the hostname. On success, the Promise is resolved with an array of objects containing available certification authority authorization records available for the hostname (e.g. [{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]).

                                                                                                                                                                                                                f
                                                                                                                                                                                                                promises.resolveCname

                                                                                                                                                                                                                Uses the DNS protocol to resolve CNAME records for the hostname. On success, the Promise is resolved with an array of canonical name records available for the hostname (e.g. ['bar.example.com']).

                                                                                                                                                                                                                  f
                                                                                                                                                                                                                  promises.resolveMx

                                                                                                                                                                                                                  Uses the DNS protocol to resolve mail exchange records (MX records) for the hostname. On success, the Promise is resolved with an array of objects containing both a priority and exchange property (e.g.[{priority: 10, exchange: 'mx.example.com'}, ...]).

                                                                                                                                                                                                                    f
                                                                                                                                                                                                                    promises.resolveNaptr

                                                                                                                                                                                                                    Uses the DNS protocol to resolve regular expression-based records (NAPTR records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

                                                                                                                                                                                                                      f
                                                                                                                                                                                                                      promises.resolveNs

                                                                                                                                                                                                                      Uses the DNS protocol to resolve name server records (NS records) for the hostname. On success, the Promise is resolved with an array of name server records available for hostname (e.g.['ns1.example.com', 'ns2.example.com']).

                                                                                                                                                                                                                        f
                                                                                                                                                                                                                        promises.resolvePtr

                                                                                                                                                                                                                        Uses the DNS protocol to resolve pointer records (PTR records) for the hostname. On success, the Promise is resolved with an array of strings containing the reply records.

                                                                                                                                                                                                                          f
                                                                                                                                                                                                                          promises.resolveSoa

                                                                                                                                                                                                                          Uses the DNS protocol to resolve a start of authority record (SOA record) for the hostname. On success, the Promise is resolved with an object with the following properties:

                                                                                                                                                                                                                            f
                                                                                                                                                                                                                            promises.resolveSrv

                                                                                                                                                                                                                            Uses the DNS protocol to resolve service records (SRV records) for the hostname. On success, the Promise is resolved with an array of objects with the following properties:

                                                                                                                                                                                                                              f
                                                                                                                                                                                                                              promises.resolveTxt

                                                                                                                                                                                                                              Uses the DNS protocol to resolve text queries (TXT records) for the hostname. On success, the Promise is resolved with a two-dimensional array of the text records available for hostname (e.g.[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]). Each sub-array contains TXT chunks of one record. Depending on the use case, these could be either joined together or treated separately.

                                                                                                                                                                                                                                f
                                                                                                                                                                                                                                promises.reverse

                                                                                                                                                                                                                                Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.

                                                                                                                                                                                                                                  f
                                                                                                                                                                                                                                  promises.setDefaultResultOrder

                                                                                                                                                                                                                                  Set the default value of order in dns.lookup() and [lookup](/api/node/dns/#promises. The value could be:

                                                                                                                                                                                                                                    f
                                                                                                                                                                                                                                    promises.setServers

                                                                                                                                                                                                                                    Sets the IP address and port of servers to be used when performing DNS resolution. The servers argument is an array of RFC 5952 formatted addresses. If the port is the IANA default DNS port (53) it can be omitted.

                                                                                                                                                                                                                                      Variables #

                                                                                                                                                                                                                                      v
                                                                                                                                                                                                                                      promises.ADDRGETNETWORKPARAMS
                                                                                                                                                                                                                                      No documentation available
                                                                                                                                                                                                                                        v
                                                                                                                                                                                                                                        promises.BADFAMILY
                                                                                                                                                                                                                                        No documentation available
                                                                                                                                                                                                                                          v
                                                                                                                                                                                                                                          promises.BADFLAGS
                                                                                                                                                                                                                                          No documentation available
                                                                                                                                                                                                                                            v
                                                                                                                                                                                                                                            promises.BADHINTS
                                                                                                                                                                                                                                            No documentation available
                                                                                                                                                                                                                                              v
                                                                                                                                                                                                                                              promises.BADNAME
                                                                                                                                                                                                                                              No documentation available
                                                                                                                                                                                                                                                v
                                                                                                                                                                                                                                                promises.BADQUERY
                                                                                                                                                                                                                                                No documentation available
                                                                                                                                                                                                                                                  v
                                                                                                                                                                                                                                                  promises.BADRESP
                                                                                                                                                                                                                                                  No documentation available
                                                                                                                                                                                                                                                    v
                                                                                                                                                                                                                                                    promises.BADSTR
                                                                                                                                                                                                                                                    No documentation available
                                                                                                                                                                                                                                                      v
                                                                                                                                                                                                                                                      promises.CANCELLED
                                                                                                                                                                                                                                                      No documentation available
                                                                                                                                                                                                                                                        v
                                                                                                                                                                                                                                                        promises.CONNREFUSED
                                                                                                                                                                                                                                                        No documentation available
                                                                                                                                                                                                                                                          v
                                                                                                                                                                                                                                                          promises.DESTRUCTION
                                                                                                                                                                                                                                                          No documentation available
                                                                                                                                                                                                                                                            v
                                                                                                                                                                                                                                                            promises.EOF
                                                                                                                                                                                                                                                            No documentation available
                                                                                                                                                                                                                                                              v
                                                                                                                                                                                                                                                              promises.FILE
                                                                                                                                                                                                                                                              No documentation available
                                                                                                                                                                                                                                                                v
                                                                                                                                                                                                                                                                promises.FORMERR
                                                                                                                                                                                                                                                                No documentation available
                                                                                                                                                                                                                                                                  v
                                                                                                                                                                                                                                                                  promises.LOADIPHLPAPI
                                                                                                                                                                                                                                                                  No documentation available
                                                                                                                                                                                                                                                                    v
                                                                                                                                                                                                                                                                    promises.NODATA
                                                                                                                                                                                                                                                                    No documentation available
                                                                                                                                                                                                                                                                      v
                                                                                                                                                                                                                                                                      promises.NOMEM
                                                                                                                                                                                                                                                                      No documentation available
                                                                                                                                                                                                                                                                        v
                                                                                                                                                                                                                                                                        promises.NONAME
                                                                                                                                                                                                                                                                        No documentation available
                                                                                                                                                                                                                                                                          v
                                                                                                                                                                                                                                                                          promises.NOTFOUND
                                                                                                                                                                                                                                                                          No documentation available
                                                                                                                                                                                                                                                                            v
                                                                                                                                                                                                                                                                            promises.NOTIMP
                                                                                                                                                                                                                                                                            No documentation available
                                                                                                                                                                                                                                                                              v
                                                                                                                                                                                                                                                                              promises.NOTINITIALIZED
                                                                                                                                                                                                                                                                              No documentation available
                                                                                                                                                                                                                                                                                v
                                                                                                                                                                                                                                                                                promises.REFUSED
                                                                                                                                                                                                                                                                                No documentation available
                                                                                                                                                                                                                                                                                  v
                                                                                                                                                                                                                                                                                  promises.SERVFAIL
                                                                                                                                                                                                                                                                                  No documentation available
                                                                                                                                                                                                                                                                                    v
                                                                                                                                                                                                                                                                                    promises.TIMEOUT
                                                                                                                                                                                                                                                                                    No documentation available



                                                                                                                                                                                                                                                                                      variable ADDRCONFIG

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { ADDRCONFIG } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Limits returned address types to the types of non-loopback addresses configured on the system. For example, IPv4 addresses are only returned if the current system has at least one IPv4 address configured.

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      number

                                                                                                                                                                                                                                                                                      variable ADDRGETNETWORKPARAMS

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { ADDRGETNETWORKPARAMS } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EADDRGETNETWORKPARAMS"

                                                                                                                                                                                                                                                                                      variable ALL

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { ALL } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      If dns.V4MAPPED is specified, return resolved IPv6 addresses as well as IPv4 mapped IPv6 addresses.

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      number

                                                                                                                                                                                                                                                                                      variable BADFAMILY

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADFAMILY } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADFAMILY"

                                                                                                                                                                                                                                                                                      variable BADFLAGS

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADFLAGS } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADFLAGS"

                                                                                                                                                                                                                                                                                      variable BADHINTS

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADHINTS } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADHINTS"

                                                                                                                                                                                                                                                                                      variable BADNAME

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADNAME } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADNAME"

                                                                                                                                                                                                                                                                                      variable BADQUERY

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADQUERY } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADQUERY"

                                                                                                                                                                                                                                                                                      variable BADRESP

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADRESP } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADRESP"

                                                                                                                                                                                                                                                                                      variable BADSTR

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { BADSTR } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADSTR"

                                                                                                                                                                                                                                                                                      variable CANCELLED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { CANCELLED } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ECANCELLED"

                                                                                                                                                                                                                                                                                      variable CONNREFUSED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { CONNREFUSED } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ECONNREFUSED"

                                                                                                                                                                                                                                                                                      variable DESTRUCTION

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { DESTRUCTION } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EDESTRUCTION"

                                                                                                                                                                                                                                                                                      variable EOF

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { EOF } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EOF"

                                                                                                                                                                                                                                                                                      variable FILE

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { FILE } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EFILE"

                                                                                                                                                                                                                                                                                      variable FORMERR

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { FORMERR } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EFORMERR"

                                                                                                                                                                                                                                                                                      variable LOADIPHLPAPI

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { LOADIPHLPAPI } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ELOADIPHLPAPI"

                                                                                                                                                                                                                                                                                      variable NODATA

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { NODATA } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENODATA"

                                                                                                                                                                                                                                                                                      variable NOMEM

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { NOMEM } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOMEM"

                                                                                                                                                                                                                                                                                      variable NONAME

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { NONAME } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENONAME"

                                                                                                                                                                                                                                                                                      variable NOTFOUND

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { NOTFOUND } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOTFOUND"

                                                                                                                                                                                                                                                                                      variable NOTIMP

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { NOTIMP } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOTIMP"

                                                                                                                                                                                                                                                                                      variable NOTINITIALIZED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { NOTINITIALIZED } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOTINITIALIZED"

                                                                                                                                                                                                                                                                                      variable promises.ADDRGETNETWORKPARAMS

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { ADDRGETNETWORKPARAMS } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EADDRGETNETWORKPARAMS"

                                                                                                                                                                                                                                                                                      variable promises.BADFAMILY

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADFAMILY } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADFAMILY"

                                                                                                                                                                                                                                                                                      variable promises.BADFLAGS

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADFLAGS } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADFLAGS"

                                                                                                                                                                                                                                                                                      variable promises.BADHINTS

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADHINTS } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADHINTS"

                                                                                                                                                                                                                                                                                      variable promises.BADNAME

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADNAME } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADNAME"

                                                                                                                                                                                                                                                                                      variable promises.BADQUERY

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADQUERY } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADQUERY"

                                                                                                                                                                                                                                                                                      variable promises.BADRESP

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADRESP } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADRESP"

                                                                                                                                                                                                                                                                                      variable promises.BADSTR

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { BADSTR } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EBADSTR"

                                                                                                                                                                                                                                                                                      variable promises.CANCELLED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { CANCELLED } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ECANCELLED"

                                                                                                                                                                                                                                                                                      variable promises.CONNREFUSED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { CONNREFUSED } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ECONNREFUSED"

                                                                                                                                                                                                                                                                                      variable promises.DESTRUCTION

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { DESTRUCTION } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EDESTRUCTION"

                                                                                                                                                                                                                                                                                      variable promises.EOF

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { EOF } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EOF"

                                                                                                                                                                                                                                                                                      variable promises.FILE

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { FILE } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EFILE"

                                                                                                                                                                                                                                                                                      variable promises.FORMERR

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { FORMERR } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EFORMERR"

                                                                                                                                                                                                                                                                                      variable promises.LOADIPHLPAPI

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { LOADIPHLPAPI } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ELOADIPHLPAPI"

                                                                                                                                                                                                                                                                                      variable promises.NODATA

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { NODATA } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENODATA"

                                                                                                                                                                                                                                                                                      variable promises.NOMEM

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { NOMEM } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOMEM"

                                                                                                                                                                                                                                                                                      variable promises.NONAME

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { NONAME } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENONAME"

                                                                                                                                                                                                                                                                                      variable promises.NOTFOUND

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { NOTFOUND } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOTFOUND"

                                                                                                                                                                                                                                                                                      variable promises.NOTIMP

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { NOTIMP } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOTIMP"

                                                                                                                                                                                                                                                                                      variable promises.NOTINITIALIZED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { NOTINITIALIZED } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ENOTINITIALIZED"

                                                                                                                                                                                                                                                                                      variable promises.REFUSED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { REFUSED } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EREFUSED"

                                                                                                                                                                                                                                                                                      variable promises.SERVFAIL

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { SERVFAIL } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ESERVFAIL"

                                                                                                                                                                                                                                                                                      variable promises.TIMEOUT

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { promises } from "node:dns";
                                                                                                                                                                                                                                                                                      const { TIMEOUT } = promises;
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ETIMEOUT"

                                                                                                                                                                                                                                                                                      variable REFUSED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { REFUSED } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "EREFUSED"

                                                                                                                                                                                                                                                                                      variable SERVFAIL

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { SERVFAIL } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ESERVFAIL"

                                                                                                                                                                                                                                                                                      variable TIMEOUT

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { TIMEOUT } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      "ETIMEOUT"

                                                                                                                                                                                                                                                                                      variable V4MAPPED

                                                                                                                                                                                                                                                                                      Usage in Deno

                                                                                                                                                                                                                                                                                      import { V4MAPPED } from "node:dns";
                                                                                                                                                                                                                                                                                      

                                                                                                                                                                                                                                                                                      If the IPv6 family was specified, but no IPv6 addresses were found, then return IPv4 mapped IPv6 addresses. It is not supported on some operating systems (e.g. FreeBSD 10.1).

                                                                                                                                                                                                                                                                                      Type #

                                                                                                                                                                                                                                                                                      number

                                                                                                                                                                                                                                                                                      Did you find what you needed?

                                                                                                                                                                                                                                                                                      Privacy policy