is-opus

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i is-opus

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • hemanth
  • t1st3