The domain or host for which to fetch DNS records e.g. "example.com".
Optional
type: stringThe type of DNS record to fetch (e.g., "A", "AAAA", "MX"). If not specified, all records will be fetched.
Optional
resolver: string | DNSResolverThe DNS resolver to use. It can be a built-in resolver name (like "google" or "cloudflare"), a custom resolver function, or a string URL for a DoH resolver.
import { getDnsRecords } from "diggy";
const records = await getDnsRecords("example.com");
console.log(records);
import { getDnsRecords } from "diggy";
const aRecords = await getDnsRecords("example.com", "A");
console.log(aRecords);
import { getDnsRecords } from "diggy";
const records = await getDnsRecords("example.com", "A", "google");
console.log(records);
Fetches DNS records for a given
host
and type. When notype
is specified, it retrieves all available DNS records for the host.