Body

interface

interface Body

Properties

body

readonly body: ReadableStream<Uint8Array<ArrayBuffer>> | null

A simple getter used to expose a ReadableStream of the body contents.

bodyUsed

readonly bodyUsed: boolean

Stores a Boolean that declares whether the body has been used in a response yet.

Methods

arrayBuffer

arrayBuffer(): Promise<ArrayBuffer>

Takes a Response stream and reads it to completion. It returns a promise that resolves with an ArrayBuffer.

blob

blob(): Promise<Blob>

Takes a Response stream and reads it to completion. It returns a promise that resolves with a Blob.

bytes

bytes(): Promise<Uint8Array<ArrayBuffer>>

Takes a Response stream and reads it to completion. It returns a promise that resolves with a Uint8Array.

formData

formData(): Promise<FormData>

Takes a Response stream and reads it to completion. It returns a promise that resolves with a FormData object.

json

json(): Promise<any>

Takes a Response stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as JSON.

text

text(): Promise<string>

Takes a Response stream and reads it to completion. It returns a promise that resolves with a USVString (text).

textStream

textStream(): ReadableStream<string>

Takes a Response body stream and returns a ReadableStream<string> that streams the body decoded as UTF-8 text.