Experimental API
Prefetch a hostname.
This will be used by fetch() and Bun.connect() to avoid DNS lookups.
function
Experimental API
Prefetch a hostname.
This will be used by fetch() and Bun.connect() to avoid DNS lookups.
The hostname to prefetch
The port to prefetch. Default is 443. Port helps distinguish between IPv6 vs IPv4-only connections.
import { dns } from 'bun';
dns.prefetch('example.com');
// ... something expensive
await fetch('https://example.com');