Node.js module
dns/promises
The 'node:dns/promises' module offers the same DNS resolution API as node:dns but returns Promise-based methods for cleaner async/await usage.
All lookup and resolve functions are available as promise-returning calls, eliminating the need for callback-based code.
Functions 21
- promises.getDefaultResultOrder()
Get the default value for
verbatimin lookup and dnsPromises.lookup(). - promises.getServers()
Returns an array of IP address strings, formatted according to RFC 5952, that are currently configured for DNS resolution.
- promises.lookup()
Resolves a host name (e.g.
- promises.lookupService()
Resolves the given
addressandportinto a host name and service using the operating system's underlyinggetnameinfoimplementation. - promises.resolve()
Uses the DNS protocol to resolve a host name (e.g.
- promises.resolve4()
Uses the DNS protocol to resolve IPv4 addresses (
Arecords) for thehostname. - promises.resolve6()
Uses the DNS protocol to resolve IPv6 addresses (
AAAArecords) for thehostname. - promises.resolveAny()
Uses the DNS protocol to resolve all records (also known as
ANYor*query). - promises.resolveCaa()
Uses the DNS protocol to resolve
CAArecords for thehostname. - promises.resolveCname()
Uses the DNS protocol to resolve
CNAMErecords for thehostname. - promises.resolveMx()
Uses the DNS protocol to resolve mail exchange records (
MXrecords) for thehostname. - promises.resolveNaptr()
Uses the DNS protocol to resolve regular expression-based records (
NAPTRrecords) for thehostname. - promises.resolveNs()
Uses the DNS protocol to resolve name server records (
NSrecords) for thehostname. - promises.resolvePtr()
Uses the DNS protocol to resolve pointer records (
PTRrecords) for thehostname. - promises.resolveSoa()
Uses the DNS protocol to resolve a start of authority record (
SOArecord) for thehostname. - promises.resolveSrv()
Uses the DNS protocol to resolve service records (
SRVrecords) for thehostname. - promises.resolveTlsa()
Uses the DNS protocol to resolve certificate associations (
TLSArecords) for thehostname. - promises.resolveTxt()
Uses the DNS protocol to resolve text queries (
TXTrecords) for thehostname. - promises.reverse()
Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an array of host names.
- promises.setDefaultResultOrder()
Set the default value of
orderindns.lookup()andlookup. - promises.setServers()
Sets the IP address and port of servers to be used when performing DNS resolution.
Classes 1
- class promises.Resolver
An independent resolver for DNS requests.
Variables 24
- const promises.ADDRGETNETWORKPARAMS
- const promises.BADFAMILY
- const promises.BADFLAGS
- const promises.BADHINTS
- const promises.BADNAME
- const promises.BADQUERY
- const promises.BADRESP
- const promises.BADSTR
- const promises.CANCELLED
- const promises.CONNREFUSED
- const promises.DESTRUCTION
- const promises.EOF
- const promises.FILE
- const promises.FORMERR
- const promises.LOADIPHLPAPI
- const promises.NODATA
- const promises.NOMEM
- const promises.NONAME
- const promises.NOTFOUND
- const promises.NOTIMP
- const promises.NOTINITIALIZED
- const promises.REFUSED
- const promises.SERVFAIL
- const promises.TIMEOUT