Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Interface IRandomAccessDataSource

    An IRandomAccessDataSource delivers chunks of bytes from a data source. Chunks are specified using a start and end byte offset. Chunks can be retrieved in random order.

    interface IRandomAccessDataSource {
        fetchChunk(
            startOffset: number,
            endOffset: number,
        ): Promise<
            | ArrayBuffer
            | Uint8Array<ArrayBufferLike>
            | ReadableStream<Uint8Array<ArrayBufferLike>>,
        >;
        getSize(): number;
    }

    Methods

    • Fetch a chunk of data from the data source between a start and end offset. This method must not throw an exception in case of a non-recoverable error.

      Parameters

      • startOffset: number

        An index into the data source indicating the first byte to include in the result buffer

      • endOffset: number

        An index into the data source indicating the first byte that will not be included in the result buffer. Must be larger than 'start', and less than or equal to the value returned by getSize().

      Returns Promise<
          | ArrayBuffer
          | Uint8Array<ArrayBufferLike>
          | ReadableStream<Uint8Array<ArrayBufferLike>>,
      >

      Resolved with an ArrayBuffer, Uint8Array or ReadableStream containing the requested data. Rejected if it is not possible to fetch the requested data.

    • Get the size of the data source in bytes. The size will define the maximum endOffset that can be used with fetchChunk().

      Returns number