Skip to content

basalt / http/src / UploadBody

Interface: UploadBody ​

Defined in: http/src/upload.ts:56

What an upload() route's handler receives as body.

Properties ​

contentLength? ​

> optional contentLength?: number

Defined in: http/src/upload.ts:74

The request's declared Content-Length, when the client sent one (a chunked upload carries none). It bounds the WHOLE body — every part plus the multipart framing — so it is an upper bound for a single file, never its size. For that, use file.declaredLength.


fields ​

> fields: Record<string, string>

Defined in: http/src/upload.ts:67

Non-file fields (null-prototype object; a repeated name keeps its last value). Filled as the body is read: a field sent before a file is present when that file is yielded, and every field once files is exhausted.


files ​

> files: AsyncIterable<UploadedFile>

Defined in: http/src/upload.ts:61

The file parts, in order, as they arrive — for await (const file of body.files). Nothing is read from the network until this is iterated.

Released under the MIT License.