https://github.com/jhermsmeier/hxd
Speedy colored hexdump
https://github.com/jhermsmeier/hxd
cli hex hexdump
Last synced: 5 months ago
JSON representation
Speedy colored hexdump
- Host: GitHub
- URL: https://github.com/jhermsmeier/hxd
- Owner: jhermsmeier
- License: mit
- Created: 2017-04-13T00:59:32.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-11-18T15:11:00.000Z (over 3 years ago)
- Last Synced: 2025-01-08T06:48:41.936Z (5 months ago)
- Topics: cli, hex, hexdump
- Language: JavaScript
- Homepage:
- Size: 542 KB
- Stars: 35
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# hxd
[](https://npmjs.com/package/hxd)
[](https://npmjs.com/package/hxd)
[](https://npmjs.com/package/hxd)## NOTE
You might have ended up here looking for the hex editor [HxD](https://mh-nexus.de/en/hxd/).
Due to this naming conflict, this package will be renamed soon.
## Install via [npm](https://npmjs.com)
```sh
$ npm install --global hxd
```## CLI Usage
```
Usage: hxd [options] [file]Options
-h, --help Display help
-v, --version Display version number-s, --start Start reading at the given offset
-e, --end Read until the given offset
-l, --length Read "length" bytes from start--color Render output with color
--no-color Force-disable color output
--prefix Prefix output lines with a given value
``````sh
# Hexdump a given file to stdout
$ hxd filename.bin
# Or pipe to it via stdin
$ cat filename.bin | hxd
# Start, and/or end at a given offset
$ hxd -s 512K filename.bin
# This also works with hex numbers
$ hxd -s 0x200 -e 0x400 filename.bin
# Read 1024 bytes from a given offset
$ hxd -s 0xDEAD -l 1K filename.bin
# Read the last 1024 bytes of a file
$ hxd -s -1024 filename.bin
```## Module Usage
```js
var Hxd = require('hxd')
``````js
var hexStream = new Hxd({
// Deduplicate lines and print "* {lineCount}"
dedupe: true,
// Render line numbers (in hexadecimal)
lineNumbers: true,
// Render ASCII
ascii: true,
// Output with colors (ANSI)
colors: false,
// Start line offset
offset: 0,
})fs.createReadStream( filename )
.pipe( hexStream )
.pipe( process.stdout )
```## Todo
- [x] Add command line flags for options, usage & version
- [x] Add command line flags for start, end, length
- [x] Add color support (greyed out zeros, line numbers, etc.)
- [x] Add a screenshot or output samples to the README
- [ ] Display offset in bytes of repetitions instead of line count
- [ ] Improve performance even further
- [ ] Add tests
- [ ] ...