is-wav
v1.1.2
Published
Check if a Buffer/Uint8Array is a wav file.
Downloads
19,809
Maintainers
Readme
is-wav
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