I have just published a testing version of an online hexdump utility, which can be found here.
There exist a few online hexdump tools already, but these all require
you to upload a file to a remote server, which may be inappropriate.
Also, in most cases these tools produce an output quite unlike what we
are used to with
xxd and the like. I wanted something closer to
what my favorite shell utilities produce.
local file access and produces something similar to
hexdump -C’s output, without
A screenshot of the tool in action is shown below:
This tool may be useful in circumstances where you don’t have a machine with a proper operating system at hand and quickly want to inspect some file.
It still has some rough edges and especially large files may hang the browser.
I learned the rough way that
document.createTextNode() is very expensive, and
had to replace many instances of it with simple string concatenation and a
single call to
createTextNode(). That speeded things up a lot.
The most interesting part of the code is the formatting of the hex dump output, this is shown below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
This code was originally written for another purpose and it does not
format addresses over
0xffff properly, but I will fix that sooner or
More output format options (byte grouping, columns, etc.) would also be useful, but implementing that requires some cleaning up of the code above, as it is already turning crufty after a few iterations. :)