1.0.0 • Published 7 years ago

is-opus v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

is-opus

NPM version Build Status

Check if a Buffer/Uint8Array is an OPUS audio file.

Install

$ npm install --save is-opus

Usage

Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isOpus = require('is-opus');
var buffer = readChunk.sync('unicorn.opus', 0, 36);

isOpus(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.opus');
xhr.responseType = 'arraybuffer';

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

xhr.send();

API

isOpus(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 36 bytes.

License

MIT © t1st3