10000 GitHub - hemanth/is-wav: Check if a Buffer/Uint8Array is a WAV file.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

hemanth/is-wav

Repository files navigation

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

About

Check if a Buffer/Uint8Array is a WAV file.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  
0