This repository provides command-line tools to interact with the varint/uvarint format, as used by Protocol Buffer and Go's encoding/binary package.
The {u,}varint-encode
tools take integers on the command line and
output binary. Use --
to pass negative integers.
The {u,}varint-decode
tools read standard input and output integers,
one per line.
Examples:
$ uvarint-encode 42 | hexdump -x
0000000 002a
0000001
$ varint-encode -- -42 | hexdump -x
0000000 0053
0000001
$ uvarint-encode 42 | uvarint-decode
42
$ varint-encode 42 | varint-decode
42
$ varint-encode -- -42 | varint-decode
-42