property

BunFetchRequestInit.timeout

timeout?: number | boolean

Control the socket idle timeout for this request. The timer is reset on every byte sent or received; if the connection stays idle for longer than this, the request fails with a timeout error.

  • A finite positive number sets the idle deadline in milliseconds, overriding the BUN_CONFIG_HTTP_IDLE_TIMEOUT default (5 minutes).
  • 0, false, or a non-finite number disables the idle timer for this request.
  • true or an omitted value uses the default.

This is not a whole-request deadline; use AbortSignal.timeout(ms) for that. Not part of the Fetch API specification.

// Allow a slow streaming response to stay idle for up to an hour
const response = await fetch("https://example.com/llm", {
  timeout: 60 * 60 * 1000,
});