Skip to content
DocsGuidesReferenceBlog
Install
HomeDocsGuidesReferenceBlog
Install Bun v1.4.2
Reference
Modules/Bun/FetchSession/fetch
  • Pfetch

Modules

  • Bun
  • bun:bundle
  • bun:ffi
  • bun:jsc
  • bun:sqlite
  • bun:test
  • Globals
  • node:assert
  • node:async_hooks
  • node:buffer
  • node:child_process
  • node:cluster
  • node:crypto
  • node:dgram
  • node:diagnostics_channel
  • node:dns
  • node:dns/promises
  • node:events
  • node:fs
  • node:fs/promises
  • node:http
  • node:http2
  • node:https
  • node:inspector
  • node:inspector/promises
  • node:module
  • node:net
  • node:os
  • node:path
  • node:perf_hooks
  • node:punycode
  • node:querystring
  • node:readline
  • node:readline/promises
  • node:stream
  • node:stream/consumers
  • node:stream/promises
  • node:stream/web
  • node:string_decoder
  • node:test
  • node:test/reporters
  • node:timers/promises
  • node:tls
  • node:trace_events
  • node:tty
  • node:url
  • node:util
  • node:util/types
  • node:v8
  • node:vm
  • node:wasi
  • node:worker_threads
  • node:zlib

property

FetchSession.fetch

readonly fetch: (input: string | URL | Request, init?: BunFetchRequestInit) => Promise<Response>

fetch() with this session. The function is bound: hand it to anything that takes a fetch. A session in init does not replace this one.

It has no preconnect, so where an option is typed typeof fetch (which in Bun includes fetch.preconnect), pass session.fetch as typeof fetch.

const client = new SomeClient({ fetch: session.fetch });