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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
limit | | TransferBandwidthLimit | undefined | Optional throughput limit. Returns undefined when omitted. |
options | BandwidthThrottleOptions | Optional clock/sleep overrides for deterministic tests. |
Returns
Section titled “Returns”| BandwidthThrottle
| undefined
Throttle implementation when a limit is supplied, otherwise undefined.
Throws
Section titled “Throws”ConfigurationError When the supplied limit shape is invalid.