Documentation Index
Fetch the complete documentation index at: https://wreq.sqdsh.win/llms.txt
Use this file to discover all available pages before exploring further.
Signature
Parameters
The resource to fetch. Can be a URL string, URL object, or a Request object.
Optional request configuration.
RequestInit options
HTTP method:
GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS.Request headers. Can be a
Headers object, plain object, or array of key-value pairs.Request body. Supported types:
string, Buffer, URLSearchParams, ArrayBuffer, ArrayBufferView (for example Uint8Array), Blob, and FormData.Reusable transport context for this request (proxy + emulation settings, with connection behavior handled by the native layer). When provided, you must not also set
browser, os, proxy, or insecure.Browser fingerprint profile to use (e.g.,
'chrome_142', 'firefox_139').Operating system to emulate:
'windows', 'macos', 'linux', 'android', 'ios'.Proxy URL. Support depends on the native layer and proxy scheme.
Request timeout in milliseconds. Set to
0 to disable the timeout.AbortSignal for cancelling the request.
Redirect handling mode.
When
true, prevents browser emulation headers from being automatically added.When
true, accepts invalid/self-signed certificates. Use only in development.Optional callback for structured request lifecycle events emitted by the native layer. Use this to observe phases such as request start, response headers, and body download progress.
When
true, captures a final diagnostics payload on the response where supported by the native layer. This can include timing, address, and TLS peer details.Response
Returns aResponse object with:
status: HTTP status codestatusText: HTTP status textheaders: response headersok:trueif status is 200-299url: final URL after redirectsredirected:trueif the response is the result of a redirectbody:ReadableStream<Uint8Array>ornullbodyUsed:trueif body has been consumedcontentLength: content length from headers, ornullcookies: parsed response cookies asRecord<string, string | string[]>diagnostics: optional native diagnostics payload, ornull
Response methods
json(): parse body as JSONtext(): get body as stringarrayBuffer(): get body as ArrayBufferblob(): get body as BlobformData(): parse body as FormDataclone(): clone the response
Request lifecycle events
WhenonRequestEvent is provided, fetch() emits structured events from the native bridge.
| Event | Meaning |
|---|---|
request_start | The request has started in the native layer. |
request_sent | Request headers/body have been handed off to the socket and the client is waiting for a response. |
response_headers | Response headers have been received. Includes status and optional contentLength. |
body_progress | Additional response body bytes were downloaded. Includes downloadedBytes and optional contentLength. |
body_complete | The response body finished downloading. |
done | The native request lifecycle completed successfully. |
error | The native request lifecycle failed. Includes message when available. |
timestamp, and some events include status, url, contentLength, downloadedBytes, or message.
For a full worked example, see /guides/request-events.
Convenience helpers
get(url, init?)callsfetch(url, { ...init, method: "GET" }).post(url, body?, init?)callsfetch(url, { ...init, method: "POST", body }).request(options)is deprecated and kept for compatibility. Preferfetch(url, init).