Skip to content
Ingvar Stepanyan edited this page Sep 11, 2013 · 9 revisions

Include scripts for jDataView and jBinary like that:

<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, data) {
  console.log(binary.read('magic'));
});

// ... or, in the case you want to do some preprocessing or handle data manually:

jBinary.loadData('file.bin', function (err, data) {
  // preprocess data here
  var binary = new jBinary(data, typeSet);
  console.log(binary.read('magic'));
});
</script>
Clone this wiki locally