ChunkCombiner is a simplified platform-neutral manipulation of Uint8arrays that allows to process text data on the fly. The implementation can be optimized for the target platform (node vs browser).

interface ChunkCombiner {
    concat(first: Uint8Array, second: Uint8Array): Uint8Array;
    copy(chunk: Uint8Array, start: number, end: number): Uint8Array;
    toUtf8String(chunk: Uint8Array, start: number, end: number): string;
}

Methods

  • Concatenates first and second chunk.

    Parameters

    • first: Uint8Array

      first chunk

    • second: Uint8Array

      second chunk

    Returns Uint8Array

    first + second

  • Creates a new chunk from the supplied chunk.

    Parameters

    • chunk: Uint8Array

      chunk to copy

    • start: number

      start index

    • end: number

      end index

    Returns Uint8Array

    a copy of a chunk slice

  • Converts chunk into a string.

    Parameters

    • chunk: Uint8Array

      chunk

    • start: number

      start index

    • end: number

      end index

    Returns string

    string representation of chunk slice