Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ You can use [`node:dns`](https://nodejs.org/api/dns.html) for name resolution vi

<TypeScriptExample filename="index.ts">
```ts
import dns from "node:dns";
import dns from 'node:dns';

dns.lookup("example.org", (_err: any, address: string, ipFamily: number) =>
console.log(`address: ${address} family: IPv${ipFamily}`));
let responese = await dns.promises.resolve4('cloudflare.com', 'NS');
````

</TypeScriptExample>
Expand Down
7 changes: 4 additions & 3 deletions src/content/docs/workers/runtime-apis/nodejs/dns.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ You can use [`node:dns`](https://nodejs.org/api/dns.html) for name resolution vi

<TypeScriptExample filename="index.ts">
```ts
import dns from "node:dns";
import dns from 'node:dns';

dns.lookup("example.org", (_err: any, address: string, ipFamily: number) =>
console.log(`address: ${address} family: IPv${ipFamily}`));
let responese = await dns.promises.resolve4('cloudflare.com', 'NS');
```
</TypeScriptExample>

All `node:dns` functions are available, except `lookup`, `lookupService`, and `resolve` which throw "Not implemented" errors when called.

:::note

DNS requests will execute a subrequest, counts for your [Worker's subrequest limit](/workers/platform/limits/#subrequests).
Expand Down
Loading