is-wav

1.1.2 • Public • Published

is-wav Build Status

Check if a Buffer/Uint8Array is a WAV file.

Install

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

Usage

Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isWav = require('is-wav');
var buffer = readChunk('meow.wav', 0, 12);
 
isWav(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'meow.wav');
xhr.responseType = 'arraybuffer';
 
xhr.onload = function () {
    isWav(new Uint8Array(this.response));
    //=> true
};
 
xhr.send();

API

isWav(buffer)

Accepts a Buffer (Node.js) or Uint8Array.

It only needs the first 12 bytes.

License

MIT © Hemanth.HM

Package Sidebar

Install

npm i is-wav

Weekly Downloads

2,254

Version

1.1.2

License

MIT

Last publish

Collaborators

  • hemanth