is-mp4
Check if a Buffer/Uint8Array is a MP4 video
Last updated 12 years ago by deepak_robo .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install is-mp4 
SYNC missed versions from official npm registry.

is-mp4 Build Status

Check if a Buffer/Uint8Array is a MP4 video

Install

$ npm install --save is-mp4
$ bower install --save is-mp4
$ component install deepak1556/is-mp4

Usage

Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isMP4 = require('is-mp4');
var buffer = readChunk.sync('bigbuckbunny.mp4', 0, 8);

isMP4(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'bigbuckbunny.mp4');
xhr.responseType = 'arraybuffer';

xhr.onload = function () {
	isMP4(new Uint8Array(this.response));
	//=> true
};

xhr.send();

API

isMP4(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 8 bytes.

Current Tags

  • 0.1.0                                ...           latest (12 years ago)

1 Versions

  • 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 |