@chickenjdk/byteutils
    Preparing search index...

    Class ChunkTransformer<IsAsync>Abstract

    Type Parameters

    • IsAsync extends boolean = true | false

    Hierarchy (View Summary)

    Index

    Constructors

    • Take a non-uniform-size stream of Uint8Arrays, and join them together into uniform size Uint8Arrays. WARNING: Does not perform proper locking so expect issues with parallel async calls!

      Type Parameters

      • IsAsync extends boolean = boolean

      Parameters

      • OptionalchunkSize: number = 2000

        The size of a chunk. May be changed later.

      Returns ChunkTransformer<IsAsync>

    Properties

    resizingIsImmediate: boolean = true

    Accessors

    • get _buffered(): Uint8Array<ArrayBufferLike>

      Get the currently buffered data. Useful for custom logic

      Returns Uint8Array<ArrayBufferLike>

    • get chunkSize(): number

      The size of the buffer. NOT the size that we are allocating for new chunks.

      Returns number

    • get newChunkSize(): number

      The size that the newly allocated buffers should be. Set with .resize

      Returns number

    Methods

    • A listener for a change in the length of the transformer's internal buffer

      Returns void

    • Write a single byte

      Parameters

      • byte: number

        the byte

      Returns CouldBePossiblyPromise<void, IsAsync>

    • Change the chunk size of the buffer

      Parameters

      • chunkSize: number

        The chunk size

      Returns
          | (
              CouldBePossiblyPromise<void, IsAsync> extends PromiseLike<unknown>
                  ? Promise<void>
                  : void
          )
          | undefined

    • Write a Uint8Array or array

      Parameters

      • data: number[] | Uint8Array<ArrayBufferLike>

        The data to write

      Returns CouldBePossiblyPromise<void, IsAsync>