JavaScript (ES5.1) implementation of unix hexdump. Works in browsers and node.
Go to file
AJ ONeal cce1b04a1e v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00
bin v1.0.10: deploy as @root/hexdump 2019-10-19 22:55:00 -06:00
dist v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00
.prettierrc v1.0.10: deploy as @root/hexdump 2019-10-19 22:55:00 -06:00
LICENSE v1.0.10: deploy as @root/hexdump 2019-10-19 22:55:00 -06:00
README.md v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00
build.sh v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00
hexdump.js v1.0.10: deploy as @root/hexdump 2019-10-19 22:55:00 -06:00
package-lock.json v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00
package.json v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00
test.txt v1.1.1: add browser dist file 2019-10-19 23:13:19 -06:00

README.md

@root/hexdump

| Built by Root

Given an ArrayBuffer, will create string output similar to the unix hexdump command.

For example, the text of "Hello, World!\n" looks something like this:

        0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
0000000 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21 0a
000000e

Usage

So far it just does one thing: print an ArrayBuffer in hex, with a header:

Node.js (and WebPack)

var hexdump = require('hexdump.js').hexdump;

var str = hexdump(new Uint8Array([ 0, 1, 2, 127, 254, 255 ]));

console.log(str);

Vanilla JS (Browser)

<script src="https://unpkg.com/@root/hexdump/dist/hexdump.js"></script>
<script src="https://unpkg.com/@root/hexdump/dist/hexdump.min.js"></script>
console.log(window.hexdump(new Uint8Array([0, 1, 2, 127, 254, 255])));

CLI

hexdump.js <filepath>

Install

Centralized:

# As a library
npm install --save @root/hexdump

# As a global CLI (useful on windows)
npm install --global @root/hexdump

API

hexdump(arrayBuffer, byteOffset, byteLength);