Skip to main content
Install the library using your preferred package manager:
npm install @layered/dns-records

Deno installation

For Deno projects, you can import directly from JSR:
deno
import { getDnsRecords, getAllDnsRecords } from 'jsr:@layered/dns-records'
The library works across all JavaScript runtimes including browsers, Node.js, CloudFlare Workers, Deno, and Bun.

DNS resolvers

The library automatically selects the best DNS resolver for your runtime environment:
ResolverJavaScript RuntimeNotes
cloudflare-dnsWorks on allRequires fetch as global
google-dnsWorks on allRequires fetch as global
node-dnsNode.js onlyUses Node.js DNS module
node-digNode.js onlyUses dig command
deno-dnsDeno onlyUses Deno.resolveDns
You can explicitly specify which resolver to use when calling DNS lookup functions. The library will auto-select the best option if you don’t specify one.

Next steps

Quickstart

Learn how to make your first DNS lookup

Build docs developers (and LLMs) love