Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
hxd - HeX Dump in OCaml
hxd is a little program to output a hexdump of a // or a binary file. The main difference with xxd is to color outputs to be more fancy to read. Then, it provides a way to generate a Caml code which is a dump of inputs. This project was mostly done to be able to integrate dump of some sources (like ngrep) to an OCaml code - like dump of a smart flow (git protocol) to be able to write easily regression tests with small examples.
For a long time, I worked on several formats and protocols and it always a pain to read dump of something which is only machine-comprehensible. As a MirageOS project, core library is agnostic to the system.
hxd provides several ways to dump a source:
lib/ is the core library which needs only bigarray
lib_lwt/ is a library which can be used in a LWT context
lib_lwt_unix/ uses Lwt_io.channel
lib_string/ needs only OCaml and bigarray and provides a pretty-printer function
lib_unix/ uses unix module
Examples
With:
$ hxd.xxd --color=always dump
Or a Caml output with $ hxd.caml --with-comments dump: