Skip to content

basalt / http/src / StreamOptions

Interface: StreamOptions ​

Defined in: http/src/stream.ts:16

Properties ​

contentLength? ​

> optional contentLength?: number

Defined in: http/src/stream.ts:24

Exact body size in bytes, when it is known (a stored file's size). Sent as Content-Length so clients can show progress; omit it and the response is chunked. Never guess: a wrong value truncates or hangs the download.


contentType? ​

> optional contentType?: string

Defined in: http/src/stream.ts:18

Response media type. Default application/octet-stream.


disposition? ​

> optional disposition?: "inline" | "attachment"

Defined in: http/src/stream.ts:36

How the browser should treat the body. Default attachment — an uploaded HTML/SVG file must never render on your origin. Only set inline when rendering it is deliberate. Ignored unless filename is given.


filename? ​

> optional filename?: string

Defined in: http/src/stream.ts:30

Download filename. Sent as Content-Disposition, sanitised (sanitizeFilename) and encoded per RFC 5987 — a client-supplied name can carry no CR/LF, quotes or path separators into the header.


headers? ​

> optional headers?: Record<string, string>

Defined in: http/src/stream.ts:38

Extra response headers (CR/LF stripped from every value).


status? ​

> optional status?: number

Defined in: http/src/stream.ts:40

Response status. Default 200.

Released under the MIT License.