Transport configuration.
OptionalclientThe owning client.
Headers merged into every outgoing request.
OptionalproxyProxy URL applied to every request, if any.
Retries for transient failures on idempotent requests.
Initial retry backoff in ms.
Maximum retry backoff in ms.
Default timeout in milliseconds.
User-Agent sent with every request.
Perform a DELETE request with a JSON body and return the result.
Absolute request URL.
Optionaljson: JSONValueObject serialized as the JSON request body.
Optionaltimeout: numberOptional per-call timeout override (milliseconds).
The unwrapped result payload, or undefined for an empty body.
Download a URL straight to a file on disk.
Streams the response body to disk when the fetch implementation exposes a
stream (the global fetch does), so memory stays O(chunk) instead of
buffering the whole file and the write overlaps the download. Falls back to
buffering on shims without a body stream.
Absolute request URL.
Destination path, including extension.
Optional per-call timeout override (milliseconds).
Perform a GET request and return the unwrapped result.
Absolute request URL.
Optionalparams: ParamsOptional query parameters.
Optionaltimeout: numberOptional per-call timeout override (milliseconds).
OptionalextraHeaders: Record<string, string>The unwrapped result payload, or undefined for an empty body.
Perform a POST request with a form-encoded body and return the result.
Absolute request URL.
Optionaldata: string | ParamsObject (form-encoded) or pre-encoded string body.
Optionaltimeout: numberOptional per-call timeout override (milliseconds).
OptionalextraHeaders: Record<string, string>The unwrapped result payload, or undefined for an empty body.
Perform a POST request with a JSON body and return the result.
Absolute request URL.
Optionaljson: JSONValueObject serialized as the JSON request body.
Optionaltimeout: numberOptional per-call timeout override (milliseconds).
The unwrapped result payload, or undefined for an empty body.
Perform a PUT request with a JSON body and return the result.
Absolute request URL.
Optionaljson: JSONValueObject serialized as the JSON request body.
Optionaltimeout: numberOptional per-call timeout override (milliseconds).
The unwrapped result payload, or undefined for an empty body.
Stream a GET to a file, racing several mirror URLs and committing to the
first that responds — the fastest CDN host wins, cutting tail latency when
one mirror is slow. Losing connections are aborted. If the winning stream
fails mid-download (or every mirror's headers fail), it falls back to trying
the URLs sequentially, so racing never costs robustness.
Candidate mirror URLs (preference order; used for the fallback).
Destination path, including extension.
timeout (ms) and an optional transform stream factory.
Perform a GET request and return the raw response bytes without parsing.
Used for non-JSON payloads such as download-info XML and audio files.
Absolute request URL.
Optional per-call timeout override (milliseconds).
The raw response body.
Set the Authorization header from an OAuth token.
The OAuth token.
Set the Accept-Language header.
Language code (one of en, uz, uk, us, ru, kk, hy).
Stream a GET response straight to a file, optionally piping it through a
transform first (for example an AES-CTR decipher for an encraw stream).
The whole transfer — including the body read and the transform — runs under a single abort deadline, so a stalled stream is torn down instead of hanging. When the fetch implementation exposes no body stream, it falls back to buffering the bytes, running the transform in memory and writing once.
Absolute request URL.
Destination path, including extension.
timeout (ms) and an optional transform stream factory
(a fresh transform per call, since a transform can't be reused).
Helper for performing requests against the API.
An instance is created automatically by Client, but may also be pre-configured (custom headers, proxy, timeout) and passed in.