Skip to main content
resolve - node__dns.d.ts - Node documentation
function resolve

Usage in Deno

```typescript import { resolve } from "node:node__dns.d.ts"; ```
resolve(
hostname: string,
callback: (
err: ErrnoException | null,
addresses: string[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported. Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array of the resource records. The `callback` function has arguments `(err, records)`. When successful, `records` will be an array of resource records. The type and structure of individual results varies based on `rrtype`: On error, `err` is an [`Error`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-error) object, where `err.code` is one of the `DNS error codes`.

Parameters

hostname: string
Host name to resolve.
callback: (
err: ErrnoException | null,
addresses: string[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "A",
callback: (
err: ErrnoException | null,
addresses: string[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "A"
callback: (
err: ErrnoException | null,
addresses: string[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "AAAA",
callback: (
err: ErrnoException | null,
addresses: string[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "AAAA"
callback: (
err: ErrnoException | null,
addresses: string[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "ANY",
callback: (
err: ErrnoException | null,
addresses: AnyRecord[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "ANY"
callback: (
err: ErrnoException | null,
addresses: AnyRecord[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "CNAME",
callback: (
err: ErrnoException | null,
addresses: string[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "CNAME"
callback: (
err: ErrnoException | null,
addresses: string[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "MX",
callback: (
err: ErrnoException | null,
addresses: MxRecord[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "MX"
callback: (
err: ErrnoException | null,
addresses: MxRecord[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "NAPTR",
callback: (
err: ErrnoException | null,
addresses: NaptrRecord[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "NAPTR"
callback: (
err: ErrnoException | null,
addresses: NaptrRecord[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "NS",
callback: (
err: ErrnoException | null,
addresses: string[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "NS"
callback: (
err: ErrnoException | null,
addresses: string[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "PTR",
callback: (
err: ErrnoException | null,
addresses: string[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "PTR"
callback: (
err: ErrnoException | null,
addresses: string[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "SOA",
callback: (
err: ErrnoException | null,
addresses: SoaRecord,
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "SOA"
callback: (
err: ErrnoException | null,
addresses: SoaRecord,
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "SRV",
callback: (
err: ErrnoException | null,
addresses: SrvRecord[],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "SRV"
callback: (
err: ErrnoException | null,
addresses: SrvRecord[],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: "TXT",
callback: (
err: ErrnoException | null,
addresses: string[][],
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: "TXT"
callback: (
err: ErrnoException | null,
addresses: string[][],
) => void

Return Type

void
resolve(
hostname: string,
rrtype: string,
callback: (
err: ErrnoException | null,
addresses:
string[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord
| SrvRecord[]
| string[][]
| AnyRecord[]
,
) => void
,
): void
> [!WARNING] Deno compatibility > The `ttl` option is not supported.

Parameters

hostname: string
rrtype: string
callback: (
err: ErrnoException | null,
addresses:
string[]
| MxRecord[]
| NaptrRecord[]
| SoaRecord
| SrvRecord[]
| string[][]
| AnyRecord[]
,
) => void

Return Type

void