Skip to content

createBandwidthThrottle

function createBandwidthThrottle(limit:
| TransferBandwidthLimit
| undefined, options?: BandwidthThrottleOptions):
| BandwidthThrottle
| undefined;

Defined in: src/transfers/BandwidthThrottle.ts:48

Creates a token-bucket throttle that paces an asynchronous data pipeline to a sustained TransferBandwidthLimit.

Returns undefined when no limit is supplied so callers can omit throttling without conditional branches at the call site.

ParameterTypeDescription
limit| TransferBandwidthLimit | undefinedOptional throughput limit. Returns undefined when omitted.
optionsBandwidthThrottleOptionsOptional clock/sleep overrides for deterministic tests.

| BandwidthThrottle | undefined

Throttle implementation when a limit is supplied, otherwise undefined.

ConfigurationError When the supplied limit shape is invalid.