diggy - v1.1.1
    Preparing search index...

    Function getDnsRecords

    • Fetches DNS records for a given host and type. When no type is specified, it retrieves all available DNS records for the host.

      Parameters

      • host: string

        The domain or host for which to fetch DNS records e.g. "example.com".

      • Optionaltype: string

        The type of DNS record to fetch (e.g., "A", "AAAA", "MX"). If not specified, all records will be fetched.

      • Optionalresolver: string | DNSResolver

        The 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.

      Returns Promise<AnyDNSRecord[]>

      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);
      import { getDnsRecords } from "diggy";
      const records = await getDnsRecords("example.com", "A", "nodejs");
      console.log(records);
      import { getDnsRecords } from "diggy";
      import { customResolver } from "./my-custom-resolver";
      const records = await getDnsRecords("example.com", "A", customResolver);
      console.log(records);