4 releases (2 breaking)
0.4.0 | Mar 26, 2022 |
---|---|
0.2.1 | Dec 28, 2021 |
0.2.0 | Feb 8, 2021 |
0.1.0 | Dec 22, 2020 |
#2301 in Encoding
55KB
1K
SLoC
nachricht-nq
cargo install nachricht-nq
Transform nachricht messages between the wire format and the textual representation. By default, nq
will treat input
as binary and generate textual output. This can be used to peek into a program's output with ease.
echo -en "\x82\x01\x02" | nq
[
true,
false,
]
The -t
switch can be used to treat input as textual form instead. This is useful to format a message on the fly.
echo "[true,false]" | nq -t
(
true,
false,
)
The -e
switch will produce the output in the wire format. This is useful to canonicalize inefficiently encoded
messages or within a pipe to verify the data's validity.
echo -en "\x2f\x00\x00\x00\x00\x00\x00\x00\x02" | nq -e | hexdump -v -e '/1 "%02x "'; echo
22
The two switches can also be combined to generate the wire format from the textual representation. This is useful to quickly feed a nachricht-expecting program some data from the command line.
echo "[true,false]" | nq -te | hexdump -v -e '/1 "%02x "'; echo
82 01 02
Finally, you can edit any nachricht encoded file with the -f <PATH>
option. This will open the file in a temporary
buffer in your default editor to make changes within the textual representation.
echo -en "\x82\x01\x02" > nachricht.nch
nq -f nachricht.nch
Dependencies
~7–16MB
~229K SLoC