The following Javascript example reads and logs the first 100 bytes of a file selected by a user (via the file input):
var blob = file.slice(0, 100);
var fileReader = new FileReader();
fileReader.onload = function(event) {
var arrayBuffer = event.target.result;
var bytes = new Uint8Array(arrayBuffer);
console.log('bytes', bytes);
};
fileReader.readAsArrayBuffer(blob);
What is the equivalent to achieve the same via a Linux utility like hexdump
or od
?
UPDATE: I am looking for hexdump -d
but producing single byte decimals, instead of 2 byte decimals.