Skip to content

Taxum / @taxum/core / http / Body

Class: Body

Defined in: http/body.ts:16

Represents the body of an HTTP message, allowing for handling of various body types like streams, strings, buffers, and more.

Provides utilities for creating a body instance and transforming it into an HTTP response.

Implements

Constructors

Constructor

new Body(stream, sizeHint?, contentTypeHint?): Body

Defined in: http/body.ts:26

Creates a new Body.

Parameters

stream

ReadableStream<Uint8Array<ArrayBufferLike>>

sizeHint?

SizeHint

contentTypeHint?

string

Returns

Body

Throws

Error if the provided stream is not readable.

Properties

contentTypeHint

readonly contentTypeHint: null | string

Defined in: http/body.ts:18


readable

readonly readable: ReadableStream<Uint8Array<ArrayBufferLike>>

Defined in: http/body.ts:19


sizeHint

readonly sizeHint: SizeHint

Defined in: http/body.ts:17

Methods

[TO_HTTP_RESPONSE]()

[TO_HTTP_RESPONSE](): HttpResponse

Defined in: http/body.ts:91

Returns

HttpResponse

Implementation of

ToHttpResponse.[TO_HTTP_RESPONSE]


from()

static from(body): Body

Defined in: http/body.ts:39

Creates a new Body from a BodyLike value.

Parameters

body

BodyLike

Returns

Body