Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

is-ogg

hemanth17.8kMIT1.1.2

Check if a Buffer/Uint8Array is an OGG file.

ogg, ogv, oga, type, detect, check, is, binary, buffer, uint8array

readme

is-ogg Build Status

Check if a Buffer/Uint8Array is an OGG file.

Install

$ npm install --save is-ogg
$ bower install --save is-ogg
$ component install hemanth/is-ogg

Usage

Node.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
var xhr = new XMLHttpRequest();
xhr.open('GET', 'meow.ogg');
xhr.responseType = 'arraybuffer';

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

xhr.send();

API

isOgg(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 4 bytes.

License

MIT © Hemanth.HM