move hexdump to function
Этот коммит содержится в:
родитель
b4f0cdee78
Коммит
0834ae0ad0
@ -26,6 +26,10 @@
|
||||
var ui8 = new Uint8Array(ab);
|
||||
//console.log(ui8);
|
||||
var bytecount = 0;
|
||||
|
||||
function hexdump() {
|
||||
var head = ' 0 1 2 3 4 5 6 7 8 9 A B C D E F';
|
||||
var trail;
|
||||
var str = [].slice.call(ui8).map(function (i) {
|
||||
var h = i.toString(16);
|
||||
if (h.length < 2) {
|
||||
@ -42,17 +46,18 @@
|
||||
|
||||
return lead + ' ' + str;
|
||||
}).join('\n');
|
||||
var trail = ab.byteLength.toString(16);
|
||||
trail = ab.byteLength.toString(16);
|
||||
while (trail.length < 7) {
|
||||
trail = '0' + trail;
|
||||
}
|
||||
return head + '\n' + str + '\n' + trail
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('DEBUG with hexdump: ');
|
||||
console.log('hexdump ' + onefile.replace(/\.[^\.]*$/, '.bin'));
|
||||
console.log('');
|
||||
console.log(' 0 1 2 3 4 5 6 7 8 9 A B C D E F');
|
||||
console.log(str + '\n' + trail);
|
||||
console.log(hexdump(ui8));
|
||||
console.log('');
|
||||
|
||||
console.error('');
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user