Package Exports
- is-mp3
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-mp3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
is-mp3 
Check if a Buffer/Uint8Array is a MP3 file.
Install
$ npm install --save is-mp3
$ bower install --save is-mp3
$ component install hemanth/is-mp3
Usage
Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isMp3 = require('is-mp3');
var buffer = readChunk('meow.mp3', 0, 3);
isMp3(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'meow.mp3');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
isMp3(new Uint8Array(this.response));
//=> true
};
xhr.send();
API
isMp3(buffer)
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 4 bytes.
License
MIT © Hemanth.HM