Experimental API
Prefetch a hostname.
This will be used by fetch() and Bun.connect() to avoid DNS lookups.
Search the reference...
/
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');
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →