taglib-ts
    Preparing search index...

    Function readTags

    • Read tags and audio properties from an audio file.

      Format detection is automatic: the filename extension is tried first, then content-based magic-byte detection.

      Parameters

      • input: AudioInput

        The audio data to read. Accepts File, Blob, Uint8Array, or { data, filename }.

      • readAudioProperties: boolean = true

        When true (default), audio properties such as bitrate and duration are also extracted.

      Returns Promise<Tags>

      A Tags object. If the format is not recognised or the file is invalid, all string fields are empty strings and audioProperties is null.

      import { readTags } from 'taglib';

      // Browser File input
      const tags = await readTags(file);
      console.log(tags.title, tags.artist);

      // Raw Uint8Array with filename hint
      const tags2 = await readTags({ data: buffer, filename: 'track.mp3' });