Skip to content

sergiolenza/id3-parser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

id3-parser

Build Status

A pure JavaScript id3 tag parser.

Getting Started

Installation

npm install id3-parser --save

Usage

const ID3 = require('id3-parser');

// buffer is like fs.readFileSync('x.mp3')
ID3.parse(buffer|file|uint8Array).then(tag => {
    console.log(tag);
});

How to use inside browser?

API

parse(buffer|uint8Array|file)

Parse id3v1 and id3v2.3 tags from a buffer(Node Buffer instance), uint8Array(Uint8Array instance), or file(browser File instance). And the return value is a promise.

const ID3 = require('id3-parser');
ID3.parse(buffer|uint8Array|file).then(tag => {
    console.log(tag); // the parsed tag info
});

The typical parsed tag would be like:

module.exports = {
    version: {
        v2: {
            major: 2,
            minor: 3,
            revision: 0,
            // flags moved to v2
            flags: {
                unsync: 0,
                xheader: 0,
                experimental: 0
            }
        },
        v1: {
            major: 1,
            minor: 1
        }
    },
    title: 'Bye Bye',
    artist: 'Mariah Carey',
    album: 'E=Mc²',
    'user-defined-text-information': 'Tagging time',
    year: '2008-04-14',
    image: {
        type: 'cover-front',
        mime: 'image/jpeg',
        imageType: null,
        description: 'e',
    },
    lyrics: 'xxxxxxxxxxxxxxxxx',
    comment: '',
    track: 0,
    genre: ''
}

Typings

A typing definition file for use with id3-parser when programming in Typescript is available here. Alternatively, it may be installed using Typings. To do so, execute the following command within a folder/project with a typings.json file:

typings install id3-parser --save

License

Copyright (c) 2015 creeperyang. Licensed under the MIT license.

About

A pure JavaScript id3 tag parser.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%