Check if a Buffer/Uint8Array is an OGG file.
npm install is-ogg> Check if a Buffer/Uint8Array is an OGG file.
``sh`
$ npm install --save is-ogg
`sh`
$ bower install --save is-ogg
`sh`
$ component install hemanth/is-ogg
##### Node.js
`js
var readChunk = require('read-chunk'); // npm install read-chunk
var isOgg = require('is-ogg');
var buffer = readChunk('meow.ogg', 0, 4);
isOgg(buffer);
//=> true
`
##### Browser
`js
var xhr = new XMLHttpRequest();
xhr.open('GET', 'meow.ogg');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
isOgg(new Uint8Array(this.response));
//=> true
};
xhr.send();
``
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 4 bytes.
MIT © Hemanth.HM