is-iso
v0.2.0
Published
Check if a Buffer/Uint8Array is an ISO image
Downloads
10
Maintainers
Readme
is-iso
Check if a Buffer/Uint8Array is an ISO image.
Install
$ npm install is-iso
Usage
Node.js
var readChunk = require('read-chunk'); // npm install read-chunk
var isIso = require('is-iso');
var buffer = readChunk.sync('unicorn.iso', 0, 36870);
isIso(buffer);
//=> true
Browser
var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.iso');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
isIso(new Uint8Array(this.response));
//=> true
};
xhr.send();
API
isIso(buffer)
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 36870 bytes.
License
MIT © undisk