Skip to content

Latest commit

 

History

History
42 lines (29 loc) · 892 Bytes

README.md

File metadata and controls

42 lines (29 loc) · 892 Bytes

Installation

Install via npm:

npm install musicmetadata

API

var fs = require('fs');
var musicmetadata = require('musicmetadata');

//create a new parser from a node ReadStream
var parser = new musicmetadata(fs.createReadStream('sample.mp3'));

//listen for the metadata event
parser.on('metadata', function(result) {
    console.log(result);
});

//start the parser
parser.parse();

This will output the standard music metadata:

{ artist: 'Spor',
  album: 'Nightlife, Vol 5.',
  albumartist: ['Andy C', 'Spor'],
  title: 'Stronger',
  year: 2010,
  track: [1,44],
  disk: [1,2] }

Values can either be a String or an Array

If you just want the artist - listen for the artist event:

parser.on('artist', function(result) {
    console.log(result);
});