UNPKG

botframework-streaming

Version:

Streaming library for the Microsoft Bot Framework

61 lines 2.43 kB
/** * @module botframework-streaming */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import type { PayloadAssembler } from './assemblers'; import { PayloadTypes } from './payloads'; import type { SubscribableStream } from './subscribableStream'; /** * A stream of fixed or infinite length containing content to be decoded. */ export declare class ContentStream { id: string; private readonly assembler; private stream; /** * Initializes a new instance of the [ContentStream](xref:botframework-streaming.ContentStream) class. * * @param id The ID assigned to this instance. * @param assembler The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to this instance. */ constructor(id: string, assembler: PayloadAssembler); /** * Gets the name of the type of the object contained within this [ContentStream](xref:botframework-streaming.ContentStream). * * @returns The [PayloadType](xref:botframework-streaming.PayloadType) of this [ContentStream](xref:botframework-streaming.ContentStream). */ get contentType(): string | PayloadTypes; /** * Gets the length of this [ContentStream](xref:botframework-streaming.ContentStream). * * @returns A number representing the length of this [ContentStream](xref:botframework-streaming.ContentStream). */ get length(): number; /** * Gets the data contained within this [ContentStream](xref:botframework-streaming.ContentStream). * * @returns This [ContentStream's](xref:botframework-streaming.ContentStream) [SubscribableStream](xref:botframework-streaming.SubscribableStream). */ getStream(): SubscribableStream; /** * Closes the assembler. */ cancel(): void; /** * Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a string. * * @returns A string Promise with [SubscribableStream](xref:botframework-streaming.SubscribableStream) content. */ readAsString(): Promise<string>; /** * Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a typed JSON object. * * @returns A typed object Promise with `SubscribableStream` content. */ readAsJson<T>(): Promise<T>; private readAll; } //# sourceMappingURL=contentStream.d.ts.map