taglib-ts
    Preparing search index...

    A read/write IOStream backed by a FileSystemFileHandle from the browser's File System Access API.

    Read-write mode (default): opens a FileSystemSyncAccessHandle and uses its read/write methods with explicit byte offsets (at option) so that the internal cursor stays in sync without extra round-trips.

    Read-only mode: retrieves the underlying File blob from the handle and performs lazy slice-based reads — identical to BlobStream but named after the originating FileSystemFileHandle.

    The constructor is private; always use the async factory:

    const stream = await FileSystemFileHandleStream.open(fileHandle);
    
    // In a dedicated web worker:
    const [fileHandle] = await window.showOpenFilePicker();
    const stream = await FileSystemFileHandleStream.open(fileHandle);
    const tag = await FileRef.open(stream);

    Hierarchy (View Summary)

    Index

    Methods

    • Flushes pending writes and closes the underlying sync access handle. This is a no-op in read-only mode (the blob requires no cleanup).

      After calling close(), isOpen returns false and further I/O will produce undefined behaviour.

      Returns Promise<void>

    • Inserts data at byte offset start, optionally replacing replace bytes of existing content.

      Because FileSystemSyncAccessHandle does not support in-place insertion, this method reads the tail of the file, writes the new data, then writes the tail back.

      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>

      If the stream is read-only.

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

      Parameters

      • start: number

        Byte offset of the first byte to remove.

      • length: number

        Number of bytes to remove.

      Returns Promise<void>

      If the stream is read-only.

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

      Parameters

      • length: number

        The desired file length in bytes.

      Returns Promise<void>

      If the stream is read-only.

    • Opens a FileSystemFileHandle and wraps it in a stream.

      Parameters

      • fileHandle: FileSystemFileHandle

        The handle to open. Must be obtained via the File System Access API (e.g. window.showOpenFilePicker()).

      • readOnly: boolean = false

        When true, the stream opens the handle's File blob for read-only slice-based access instead of creating a sync handle. Defaults to false.

      Returns Promise<FileSystemFileHandleStream>

      A fully initialised FileSystemFileHandleStream.