@kayahr/datastream

    Class Uint8ArraySink

    Sink which writes into a growing Uint8Array.

    Implements

    Index

    Constructors

    Methods

    • Returns the byte at the given index.

      Parameters

      • index: number

        The index. Negative indices references bytes from the end.

      Returns undefined | number

      The found byte or undefined if out of bounds.

    • Returns number

      the current capacity. When size reaches this capacity then the internal buffer must grow.

    • Resets the sink so it can be used for another operation. This keeps the current capacity and reuses the same buffer so make sure you finished processing the previous data.

      Returns void

    • Rewinds the sink by the given number of bytes. The size shrinks accordingly but the capacity stays the same as before.

      Parameters

      • numBytes: number

        The number of bytes to remove from the end of the sink.

      Returns void

    • Writes the given chunk to the sink.

      Parameters

      • chunk: number | Uint8Array<ArrayBufferLike>

        Chunk of data to write to the sink.

      Returns void

      a promise if write operation is asynchronous, nothing when write operation is synchronous.

    MMNEPVFCICPMFPCPTTAAATR