Introducing npm Teams! Private packages + team management tools.Learn more »

is-webm

2.0.0 • Public • Published

is-webm

NPM version Build Status

Check if a Buffer/Uint8Array is a WEBM video.

Install

$ npm install --save is-webm

Usage

Node.js

var readChunk = require('read-chunk'); // npm install read-chunk
var isWebm = require('is-webm');
var buffer = readChunk.sync('unicorn.webm', 0, 4);
 
isWebm(buffer);
//=> true

Browser

var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.webm');
xhr.responseType = 'arraybuffer';
 
xhr.onload = function () {
    isWebm(new Uint8Array(this.response));
    //=> true
};
 
xhr.send();

API

isWebm(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 4 bytes.

License

MIT © t1st3

Install

npm i is-webm

DownloadsWeekly Downloads

5

Version

2.0.0

License

MIT

Unpacked Size

2.85 kB

Total Files

4

Last publish

Collaborators

  • avatar