A pure JavaScript id3 tag parser.
npm install id3-parser --save
const ID3 = require('id3-parser');
// buffer is like fs.readFileSync('x.mp3')
ID3.parse(buffer|file|uint8Array).then(tag => {
console.log(tag);
});
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: ''
}
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
Copyright (c) 2015 creeperyang. Licensed under the MIT license.