is-mp3
Check if a Buffer/Uint8Array is a MP3 file.
Last updated 9 years ago by hemanth .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-mp3 
SYNC missed versions from official npm registry.

is-mp3 Build Status

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

Current Tags

  • 1.1.3                                ...           latest (9 years ago)

8 Versions

  • 1.1.3                                ...           9 years ago
  • 1.1.2                                ...           10 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.3.0                                ...           11 years ago
  • 0.2.0                                ...           11 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |