Check if a Buffer/Uint8Array is a wav file.
npm install is-wav> Check if a Buffer/Uint8Array is a WAV file.
``sh`
$ npm install --save is-wav
`sh`
$ bower install --save is-wav
`sh`
$ component install hemanth/is-wav
##### Node.js
`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
`js
var xhr = new XMLHttpRequest();
xhr.open('GET', 'meow.wav');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
isWav(new Uint8Array(this.response));
//=> true
};
xhr.send();
``
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 12 bytes.
MIT © Hemanth.HM