Usage in Browser

Ingvar Stepanyan edited this page Apr 13, 2014 · 9 revisions

Recommended way is to install library with Component as jDataView/jBinary or with Bower as jbinary.

If you don't use any of those, include scripts for jDataView and jBinary like in following sample:

<script src="//jdataview.github.io/dist/jdataview.js"></script>
<script src="//jdataview.github.io/dist/jbinary.js"></script>

<script>
var typeSet = {
  magic: ['array', 'uint8', 4]
};

jBinary.load('file.bin', typeSet, function (err, binary) {
  console.log(binary.read('magic'));
});
</script>