JavaScript (ES5.1) implementation of unix hexdump. Works in browsers and node.
Go to file
AJ ONeal 4e6e2f5914 Merge branch 'master' of ssh://git.coolaj86.com:22042/coolaj86/hexdump.js 2017-10-28 02:17:54 -06:00
bin show ascii too 2017-10-06 20:30:21 -06:00
README.md update for maintainer 2017-10-25 17:53:08 -06:00
hexdump.js show ascii too 2017-10-06 20:30:21 -06:00
package.json v1.0.6 2017-10-28 02:17:43 -06:00
test.txt change name, add README.md 2017-09-25 12:36:19 -06:00

README.md

hexdump.js

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:

JavaScript

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

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

console.log(str);

Browser

console.log(window.hexdump(new Uint8Array([ 0, 1, 2, 127, 254, 255 ])));

CLI

hexdump.js <filepath>

Install

Decentralized:

# As a library
npm install --save 'git+https://git.coolaj86.com/coolaj86/hexdump.js.git'

# As a global CLI (useful on windows)
npm install --global 'git+https://git.coolaj86.com/coolaj86/hexdump.js.git'

Centralized:

# As a library
npm install --save hexdump.js

# As a global CLI (useful on windows)
npm install --global hexdump.js

API

hexdump(arrayBuffer, byteOffset, byteLength);