Skip to content

dns

You can use node:dns ↗︎ for name resolution via DNS over HTTPS using Cloudflare DNS ↗︎ at 1.1.1.1.

index.jsjs
import dns from "node:dns";

const addresses = await dns.promises.resolve4("cloudflare.com");
console.log(addresses);
index.tsts
import dns from "node:dns";

const addresses = await dns.promises.resolve4("cloudflare.com");
console.log(addresses);

All node:dns functions are available, except lookupService, which throws a "Not implemented" error when called.

The full node:dns API is documented in the Node.js documentation for node:dns ↗︎.

Was this helpful?

⌂ 换网址