is-mkv

2.0.0 • Public • Published

is-mkv

NPM version Build Status

Check if a Buffer/Uint8Array is a MKV video

Install

$ npm install --save is-mkv

Usage

Node.js

var readChunk = require('read-chunk'); // npm install read-chunk
var isMkv = require('is-mkv');
var buffer = readChunk.sync('unicorn.mkv', 0, 39);
 
isMkv(buffer);
//=> true

Browser

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

API

isMkv(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 39 bytes.

License

MIT © t1st3

Package Sidebar

Install

npm i is-mkv

Weekly Downloads

4

Version

2.0.0

License

MIT

Unpacked Size

2.94 kB

Total Files

4

Last publish

Collaborators

  • t1st3