taglib-ts
    Preparing search index...

    An in-memory IOStream backed by an array of Uint8Array chunks.

    Unlike ByteVectorStream, data is never stored as one contiguous buffer. This is efficient when working with large media files where only specific regions need to be modified — existing chunks can be sliced and reused without copying the whole buffer.

    Additionally, the chunk array can be passed directly to a Blob constructor, enabling zero-copy export for browser environments.

    All I/O methods are async to satisfy the IOStream contract; the underlying operations are synchronous in-memory computations.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Returns a Blob whose parts are the individual chunks, avoiding a full buffer copy in browser environments.

      Parameters

      • Optionalmime: string

        Optional MIME type for the Blob.

      Returns Blob

    • Returns a copy of the internal chunk array. Each element is a copy of the corresponding chunk.

      Returns Uint8Array<ArrayBufferLike>[]

    • Inserts data at byte offset start, optionally replacing replace bytes of existing content. Builds a new chunk array from slices of existing chunks to avoid unnecessary data copies.

      Parameters

      • data: ByteVector

        The bytes to insert.

      • start: number

        Byte offset at which to begin the insertion.

      • replace: number = 0

        Number of existing bytes to overwrite. Defaults to 0.

      Returns Promise<void>

    • Removes length bytes beginning at byte offset start. Builds a new chunk array from slices of the existing chunks on either side of the removed region.

      Parameters

      • start: number

        Byte offset of the first byte to remove.

      • length: number

        Number of bytes to remove.

      Returns Promise<void>

    • Truncates or zero-extends the stream to exactly length bytes. If the current position exceeds the new length, it is clamped.

      Parameters

      • length: number

        The desired stream length in bytes.

      Returns Promise<void>

    • Writes data at the current position, overwriting existing content byte by byte across chunk boundaries and appending a new chunk if the write extends past the end. Advances the position by data.length.

      Parameters

      Returns Promise<void>

    • Creates a ChunkedByteVectorStream from an existing array of chunks.

      This factory avoids the overhead of the spread-argument constructor when the chunk array is already available. Empty chunks are silently discarded.

      Parameters

      • chunks: Uint8Array<ArrayBufferLike>[]

        The initial chunk array.

      Returns ChunkedByteVectorStream