fix hexdump function

This commit is contained in:
AJ ONeal 2017-02-17 18:52:15 -07:00
parent 0834ae0ad0
commit 39de466876
1 changed files with 5 additions and 5 deletions

View File

@ -23,11 +23,11 @@
var ab = dnsjs.write(json); var ab = dnsjs.write(json);
//console.log(ab); //console.log(ab);
var ui8 = new Uint8Array(ab);
//console.log(ui8); //console.log(ui8);
var bytecount = 0;
function hexdump() { function hexdump(ab) {
var ui8 = new Uint8Array(ab);
var bytecount = 0;
var head = ' 0 1 2 3 4 5 6 7 8 9 A B C D E F'; var head = ' 0 1 2 3 4 5 6 7 8 9 A B C D E F';
var trail; var trail;
var str = [].slice.call(ui8).map(function (i) { var str = [].slice.call(ui8).map(function (i) {
@ -50,14 +50,14 @@
while (trail.length < 7) { while (trail.length < 7) {
trail = '0' + trail; trail = '0' + trail;
} }
return head + '\n' + str + '\n' + trail return head + '\n' + str + '\n' + trail;
} }
console.log(''); console.log('');
console.log('DEBUG with hexdump: '); console.log('DEBUG with hexdump: ');
console.log('hexdump ' + onefile.replace(/\.[^\.]*$/, '.bin')); console.log('hexdump ' + onefile.replace(/\.[^\.]*$/, '.bin'));
console.log(''); console.log('');
console.log(hexdump(ui8)); console.log(hexdump(ab));
console.log(''); console.log('');
console.error(''); console.error('');