Skip to content

maybeExternalizeBatch

function maybeExternalizeBatch(
batch,
config?,
onUpload?,
force?
): Promise<VgiBatch>;

Defined in: src/external.ts:263

Maybe externalize a batch if it exceeds the threshold. Returns the original batch unchanged if below threshold or no config.

Parameter Type Default value Description
batch VgiBatch undefined -
config? | ExternalLocationConfig | null undefined -
onUpload? (bytes) => void undefined Called with bytes actually uploaded. Keeping accounting at this common path prevents new upload call sites from bypassing the total.
force? boolean false Bypass only the configured threshold when a negotiated response budget would otherwise reject a batch external storage can rescue.

Promise<VgiBatch>