taglib-ts
    Preparing search index...

    A read/write IOStream backed by a Deno.FsFile from Deno's native file system API.

    Read-write mode (default): opens the file with { read: true, write: true }. All mutating operations (writeBlock, insert, removeBlock, truncate) are available.

    Read-only mode: opens the file with { read: true } only. Any attempt to call a mutating method throws an Error.

    The constructor is private. Always use one of the async factories:

    const stream = await DenoFileStream.open("/path/to/audio.mp3");
    const ro = await DenoFileStream.openReadOnly("/path/to/audio.mp3");
    // Read-write
    const stream = await DenoFileStream.open("song.mp3");
    const tag = await FileRef.open(stream);
    await stream.close();
    // Read-only
    const stream = await DenoFileStream.openReadOnly("song.flac");
    const tag = await FileRef.open(stream);
    await stream.close();

    Hierarchy (View Summary)

    Index

    Methods

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

      Because Deno.FsFile does not support in-place insertion, this method reads the tail of the file, writes the new data at start, then writes the tail back, and truncates if necessary.

      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.

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

      Parameters

      • length: number

        Maximum number of bytes to read.

      Returns Promise<ByteVector>

      Resolves with a ByteVector containing the bytes read. May be shorter than length when the end of the file is reached.

    • 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.

      Parameters

      • length: number

        The desired file length in bytes.

      Returns Promise<void>

      If the stream is read-only.

    • Opens a file at path for reading and optionally writing.

      Internally calls:

      await Deno.open(path, { read: true, write: true, create: create ?? false })
      

      Parameters

      • path: string

        Absolute or relative path to the file.

      • Optionalcreate: boolean

        When true the file is created if it does not exist. Defaults to false.

      Returns Promise<DenoFileStream>

      A fully initialised DenoFileStream in read-write mode.

    • Opens a file at path for reading only.

      Internally calls:

      await Deno.open(path, { read: true })
      

      Parameters

      • path: string

        Absolute or relative path to the file.

      Returns Promise<DenoFileStream>

      A fully initialised DenoFileStream in read-only mode.