Skip to main content
Version: Next

HTTPResponse.stream() method

Returns the response body as a stream of chunks as they arrive from the network.

Signature​

class HTTPResponse {
abstract stream(): Promise<ReadableStream<Uint8Array>>;
}

Returns:

Promise<ReadableStream<Uint8Array>>

Remarks​

Call this from the response event to receive the body while it is still loading. If the body has already finished loading, the stream contains the whole body as a single chunk.