ContentStream class
A stream of fixed or infinite length containing content to be decoded.
Constructors
Content |
Initializes a new instance of the ContentStream class. |
Properties
content |
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. |
get |
Gets the data contained within this ContentStream. |
read |
Gets the SubscribableStream content as a typed JSON object. |
read |
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()
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.