ContentStream class

A stream of fixed or infinite length containing content to be decoded.

Constructors

ContentStream(string, PayloadAssembler)

Initializes a new instance of the ContentStream class.

Properties

contentType

Gets the name of the type of the object contained within this ContentStream.

id
length

Gets the length of this ContentStream.

Methods

cancel()

Closes the assembler.

getStream()

Gets the data contained within this ContentStream.

readAsJson<T>()

Gets the SubscribableStream content as a typed JSON object.

readAsString()

Gets the SubscribableStream content as a string.

Constructor Details

ContentStream(string, PayloadAssembler)

Initializes a new instance of the ContentStream class.

new ContentStream(id: string, assembler: PayloadAssembler)

Parameters

id

string

The ID assigned to this instance.

assembler
PayloadAssembler

The PayloadAssembler assigned to this instance.

Property Details

contentType

Gets the name of the type of the object contained within this ContentStream.

string | PayloadTypes contentType

Property Value

string | PayloadTypes

The PayloadType of this ContentStream.

id

id: string

Property Value

string

length

Gets the length of this ContentStream.

number length

Property Value

number

A number representing the length of this ContentStream.

Method Details

cancel()

Closes the assembler.

function cancel()

getStream()

Gets the data contained within this ContentStream.

function getStream(): SubscribableStream

Returns

This ContentStream's SubscribableStream.

readAsJson<T>()

Gets the SubscribableStream content as a typed JSON object.

function readAsJson<T>(): Promise<T>

Returns

Promise<T>

A typed object Promise with SubscribableStream content.

readAsString()

Gets the SubscribableStream content as a string.

function readAsString(): Promise<string>

Returns

Promise<string>

A string Promise with SubscribableStream content.