UNPKG

@microsoft/msgraph-sdk-core

Version:
38 lines 1.94 kB
/** * ------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. * See License in the project root for license information. * ------------------------------------------------------------------------------------------- */ /** * @class * * A class that provides seekable read access to a `ReadableStream` of `Uint8Array`. * This class allows reading specific sections of a stream without seeking backwards. */ export declare class SeekableStreamReader { private readonly stream; private readonly reader; private cachedChunk?; private cachedPosition; private cachedOffset; /** * Creates an instance of SeekableStreamReader. * @param {ReadableStream<Uint8Array>} stream - The readable stream to read from. */ constructor(stream: ReadableStream<Uint8Array>); /** * Reads a section of the stream from the specified start position to the end position. * * This method reads data from the stream starting at the `start` position and ending at the `end` position. * It ensures that the read operation does not seek backwards and handles chunked reading from the stream. * The read data is collected into a single `ArrayBuffer` and returned. * * @param {number} start - The starting position of the section to read. Must be non-negative. * @param {number} end - The ending position of the section to read. Must be greater than the start position. * @returns {Promise<ArrayBuffer>} A promise that resolves to an `ArrayBuffer` containing the read section. * @throws {Error} If the start position is negative, the end position is not greater than the start position, or if seeking backwards. */ readSection(start: number, end: number): Promise<ArrayBuffer>; } //# sourceMappingURL=SeekableStreamReader.d.ts.map