Skip to content

basalt / drives/src / DriveFetchOptions

Interface: DriveFetchOptions ​

Defined in: drives/src/fetch.ts:96

Properties ​

allowedHosts ​

> allowedHosts: readonly string[]

Defined in: drives/src/fetch.ts:98

Hosts the caller may reach. Exact host, or .suffix for subdomains of it.


allowedSchemes? ​

> optional allowedSchemes?: readonly string[]

Defined in: drives/src/fetch.ts:132

URL schemes the caller may use. Default ['https:'] — every one of the cloud providers this package targets is https-only, and a bearer token on a cleartext connection is a token on the wire.

Widening it is deliberate and separate from allowPrivateHosts: an operator pointing this at a self-hosted server inside their own network has to say so in one place a reviewer can find, rather than getting cleartext as a side effect of allowing a private address.


allowPrivateHosts? ​

> optional allowPrivateHosts?: boolean

Defined in: drives/src/fetch.ts:121

Escape hatch for a self-hosted provider on a private network. Off by default.


deadlineMs? ​

> optional deadlineMs?: number

Defined in: drives/src/fetch.ts:117

Wall-clock bound on the whole exchange — every redirect hop, the headers and the entire body. Off by default: a large download on a slow link is legitimate, and only the app knows how long it can wait. Set it when a worker must never be pinned by a provider (or a CDN) that trickles.


lookup? ​

> optional lookup?: (host) => Promise<object[]>

Defined in: drives/src/fetch.ts:143

Injected resolver (tests). Matches @basaltkit/webhooks' guard option.

Parameters ​

host ​

string

Returns ​

Promise<object[]>


maxBytes? ​

> optional maxBytes?: number

Defined in: drives/src/fetch.ts:102

Default byte cap. Default 100 MiB.


maxRedirects? ​

> optional maxRedirects?: number

Defined in: drives/src/fetch.ts:119

Redirect hops allowed. Default 3.


provider ​

> provider: string

Defined in: drives/src/fetch.ts:100

Provider name, used only in error messages.


retryAfterFromBody? ​

> optional retryAfterFromBody?: (body) => number | undefined

Defined in: drives/src/fetch.ts:141

Reads a vendor-specific retry hint out of a 429/503 body — see DriveProvider.retryAfterFromBody.

At most RATE_LIMIT_BODY_BYTES of the body are read before it is abandoned, so an error path can never be turned into an unbounded read. A Retry-After header, when present, wins.

Parameters ​

body ​

string

Returns ​

number | undefined


timeoutMs? ​

> optional timeoutMs?: number

Defined in: drives/src/fetch.ts:110

Socket inactivity timeout, and the wall-clock bound on each hop's wait for response headers. Default 30 s.

Not a bound on the whole exchange: a body that keeps delivering a byte every few seconds never trips it. That is deadlineMs.


transport? ​

> optional transport?: Transport

Defined in: drives/src/fetch.ts:148

Injected transport (tests). Receives an already-validated target. Production leaves it unset and gets the pinned node:http/https client.

Released under the MIT License.