Options
All
  • Public
  • Public/Protected
  • All
Menu

Class for

  • reading ID3v1/2 and MP3 information
  • removing ID3v1/2

Basic usage example:

import {IMP3, MP3} from 'jamp3';

async function run(): Promise<void> {
const mp3 = new MP3();
const filename = 'demo.mp3';
const options: IMP3.ReadOptions = {
mpeg: true, // read mpeg information
mpegQuick: true, // estimate mpeg information based on mpeg header (XING|Info) and stop reading if tags and header are found
id3v2: true, // read ID3 v2 tag
id3v1: false, // read ID3 v1 tag
id3v1IfNotID3v2: true, // read ID3 v1 tag only if no ID3 v2 tag is found (stops reading otherwise)
raw: false // do not parse frames & return all frames as binary blobs
};
const data = await mp3.read(filename, options);
console.log('mp3:', data);
}

run().catch(e => {
console.error(e);
});

Hierarchy

  • MP3

Index

Constructors

Methods

  • Reads a file in given path with given options

    Parameters

    • filename: string

      the file to read

    • options: ReadOptions

      define which information should be returned

    Returns Promise<Result>

    a object returning parsed information

  • readStream(stream: Readable, options: ReadOptions, streamSize?: number): Promise<Result>
  • Reads a stream with given options

    Parameters

    • stream: Readable

      the stream to read (NodeJS.stream.Readable)

    • options: ReadOptions

      define which information should be returned

    • Optional streamSize: number

      if known, provide the stream size to speed up duration calculation (otherwise stream may have to be parsed in full)

    Returns Promise<Result>

    a object returning parsed information

  • Removes ID3v1 and/or ID3v2 Tag from a file with given options

    Parameters

    • filename: string

      the file to clean

    • options: RemoveTagsOptions

      define which tags should be removed

    Returns Promise<undefined | RemoveResult>

    a object returning which tags have been removed

Generated using TypeDoc