preconnect

Bun

Symbol

fetch.preconnect

function preconnect(url: string | URL, options?: { dns: boolean; http: boolean; https: boolean; tcp: boolean }): void

Preconnect to a URL. This can be used to improve performance by pre-resolving the DNS and establishing a TCP connection before the request is made.

This is a custom property that is not part of the Fetch API specification.

@param url

The URL to preconnect to

@param options

Options for the preconnect

Referenced types

class URL

The URL interface represents an object providing static methods used for creating object URLs.

MDN Reference