Skip to main content

validateUpload

@retinue/monorepo


@retinue/monorepo / backend/src / validateUpload

Function: validateUpload()

validateUpload(input, limits): void

Defined in: backend/src/files/index.ts:80

The cheap early refusal — AC-2's first half.

"Refused before the bytes are accepted, with the limit stated." The limit is in the message because an error saying "too large" sends someone to guess; one saying "25 MB" does not.

This check can only ever see the declared size. A client that declares 1 KB and sends 1 GB passes it, which is why streamWithCap exists and is not optional.

Parameters​

input​

declaredBytes​

number

mediaType​

string

limits​

UploadLimits

Returns​

void