Options
All
  • Public
  • Public/Protected
  • All
Menu

DataSource that represents a section (chunk) of a larger data source (parent). Useful when chunking a data source to parallelize processing.

Hierarchy

  • DataChunk

Implements

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • Parameters

    • source: DataSource

      The parent data source for this chunk

    • start: number

      The start of this chunk, in bytes, within the parent data source

    • end: number

      The end of this chunk, in bytes, within the parent data source

    Returns DataChunk

Properties

Private _buffer

_buffer: ArrayBuffer = null

Variable to store the loaded data for this chunk.

Private end

end: number

The end of the data, in bytes, this chunk represents within its parent data source.

Private source

source: DataSource

The parent data source this chunk belongs to.

Private start

start: number

The start of the data, in bytes, this chunk represents within its parent data source.

Accessors

buffer

  • get buffer(): ArrayBuffer
  • When this chunk is loaded, returns the buffer containing the data for this chunk, null otherwise.

    Returns ArrayBuffer

byteLength

  • get byteLength(): Promise<number>
  • The total byte length this chunk represents.

    NOTE: This value can change after a chunk is loaded for the first time if the chunk belongs to a remote data source, if the total size is unknown, the value will be -1.

    Returns Promise<number>

loaded

  • get loaded(): boolean

Methods

load

  • load(): Promise<void>
  • Loads this chunk into memory.

    NOTE: If this chunk belongs to a remote DataSource, this function waits until the data for this chunk has been transferred from the remote and into memory. Also, if the final size for the remote DataSource is unknown, the byteLength of this chunk could change after it finishes loading.

    Returns Promise<void>

loadData

  • loadData(start?: number, end?: number): Promise<ArrayBuffer>
  • Loads the data source into an ArrayBuffer. Optionally a start and end can be specified to load a part of the data.

    Parameters

    • start: number = 0

      The offset at which the data will start loading

    • end: number = ...

      The offset at which the data will stop loading

    Returns Promise<ArrayBuffer>

slice

  • Slices this chunk and returns a new data chunk pointing at the data within the specified boundaries.

    Parameters

    • start: number

      Pointer to the start of the data in bytes

    • end: number

      Pointer to the end of the data in bytes

    Returns DataSource

unload

  • unload(): void

Generated using TypeDoc