Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • IRandomAccessDataSource

Index

Methods

fetchChunk

  • fetchChunk(startOffset: number, endOffset: number): Promise<Uint8Array | ArrayBuffer | ReadableStream<Uint8Array>>
  • 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<Uint8Array | ArrayBuffer | ReadableStream<Uint8Array>>

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

getSize

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

    Returns number

Generated using TypeDoc