taglib-ts
    Preparing search index...

    Class IOStreamAbstract

    Abstract base class for I/O streams. Concrete subclasses provide byte-level read/write access to a backing store (file, memory, network, etc.).

    All I/O and position methods are async to support backends such as Blob/File, FileSystemFileHandle, and the Deno native FS API where operations like seeking and querying length are genuinely asynchronous.

    Only identity/flag queries (name, readOnly, isOpen) remain synchronous.

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Resets the stream position to the beginning (equivalent to seek(0, Position.Beginning)).

      Returns Promise<void>

    • Inserts data at byte offset start, optionally replacing replace bytes of existing content. The position is set to start + data.length after the operation.

      Parameters

      • data: ByteVector

        The bytes to insert.

      • start: number

        Byte offset at which to begin the insertion.

      • Optionalreplace: number

        Number of existing bytes to overwrite starting at start. Defaults to 0 (pure insertion).

      Returns Promise<void>

    • Returns true if the stream is currently open and available for I/O.

      Returns boolean

    • Returns the total length of the stream in bytes.

      Returns Promise<number>

    • Returns the name or identifier of the stream (e.g., a file path).

      Returns string

    • Reads up to length bytes from the current stream position and advances the position by the number of bytes actually read.

      Parameters

      • length: number

        Maximum number of bytes to read.

      Returns Promise<ByteVector>

      A ByteVector containing the bytes read. May be shorter than length if the end of the stream is reached.

    • Returns true if the stream does not support write operations.

      Returns boolean

    • Removes length bytes beginning at byte offset start, shifting all subsequent bytes towards the beginning of the stream.

      Parameters

      • start: number

        Byte offset of the first byte to remove.

      • length: number

        Number of bytes to remove.

      Returns Promise<void>

    • Moves the read/write position within the stream.

      Parameters

      • offset: number

        Number of bytes to move relative to position.

      • Optionalposition: Position

        Reference point for the seek. Defaults to Position.Beginning.

      Returns Promise<void>

    • Returns the current read/write position in bytes from the start of the stream.

      Returns Promise<number>

    • Truncates or extends the stream to exactly length bytes. If the new length is greater than the current length, the extension is zero-filled. 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 stream position, overwriting existing content and extending the stream if necessary. Advances the position by data.length.

      Parameters

      Returns Promise<void>