node:dns
#Import
import dns from "nstdlib/node/dns";Note
Behaves like Node.js. Queries run over DNS-over-HTTPS on the host fetch. lookup, resolve4/6/Cname/Ns/Ptr/Txt/Mx/Srv/Soa and reverse are real. lookupService, setServers, setLocalAddress and resolveAny/Naptr/Tlsa/Caa throw by name.
#Support
- nstd: 5/31 of Node's own eligible tests pass under nstd.
- Browser: Loads with a minimal
processobject. 50 of Node's 50 exports are available. 1 of 1 behavior checks match Node.js.
#Exports (50)
Every name Node.js exports from this module, and what you get when you read it, as a named import or as a property of the default import:
- ✅ A value, both ways. An export that throws an error naming the missing feature also counts.
- ⚠️ A value one way,
undefinedthe other. - ❔
undefinedboth ways. - ❌ Not exported at all.
- – Not measured.
Show all 50 exports
| Export | Node.js | Browser |
|---|---|---|
ADDRCONFIG | ✅ | ✅ |
ADDRGETNETWORKPARAMS | ✅ | ✅ |
ALL | ✅ | ✅ |
BADFAMILY | ✅ | ✅ |
BADFLAGS | ✅ | ✅ |
BADHINTS | ✅ | ✅ |
BADNAME | ✅ | ✅ |
BADQUERY | ✅ | ✅ |
BADRESP | ✅ | ✅ |
BADSTR | ✅ | ✅ |
CANCELLED | ✅ | ✅ |
CONNREFUSED | ✅ | ✅ |
DESTRUCTION | ✅ | ✅ |
EOF | ✅ | ✅ |
FILE | ✅ | ✅ |
FORMERR | ✅ | ✅ |
LOADIPHLPAPI | ✅ | ✅ |
NODATA | ✅ | ✅ |
NOMEM | ✅ | ✅ |
NONAME | ✅ | ✅ |
NOTFOUND | ✅ | ✅ |
NOTIMP | ✅ | ✅ |
NOTINITIALIZED | ✅ | ✅ |
REFUSED | ✅ | ✅ |
Resolver | ✅ | ✅ |
SERVFAIL | ✅ | ✅ |
TIMEOUT | ✅ | ✅ |
V4MAPPED | ✅ | ✅ |
getDefaultResultOrder | ✅ | ✅ |
getServers | ✅ | ✅ |
lookup | ✅ | ✅ |
lookupService | ✅ | ✅ |
promises | ✅ | ✅ |
resolve | ✅ | ✅ |
resolve4 | ✅ | ✅ |
resolve6 | ✅ | ✅ |
resolveAny | ✅ | ✅ |
resolveCaa | ✅ | ✅ |
resolveCname | ✅ | ✅ |
resolveMx | ✅ | ✅ |
resolveNaptr | ✅ | ✅ |
resolveNs | ✅ | ✅ |
resolvePtr | ✅ | ✅ |
resolveSoa | ✅ | ✅ |
resolveSrv | ✅ | ✅ |
resolveTlsa | ✅ | ✅ |
resolveTxt | ✅ | ✅ |
reverse | ✅ | ✅ |
setDefaultResultOrder | ✅ | ✅ |
setServers | ✅ | ✅ |
#Diagnostics
nstdlib running inside Node.js. This isn't an environment it's meant for, so it isn't shown above, but it tells a library problem from an environment one:
coverage: 50/50 of the host's export names answer inside host node. Behaviour verified against the host builtin. Queries run over DNS-over-HTTPS on the hostfetch.lookup,resolve4/6/Cname/Ns/Ptr/Txt/Mx/Srv/Soaandreverseare real.lookupService,setServers,setLocalAddressandresolveAny/Naptr/Tlsa/Caathrow by name.smoke: Imports in a clean child process.vitest: Test/runtime/dns.test.ts: 54/56 assertions pass.node-suite: 5/31 of Node's own eligible tests pass with ./dist inside host node. A failure there and in the page is the library's, one only in the page is the engine's.