| Crates.io | bencode-pretty |
| lib.rs | bencode-pretty |
| version | 0.1.0 |
| created_at | 2025-09-02 15:38:15.020539+00 |
| updated_at | 2025-09-02 15:38:15.020539+00 |
| description | A small program to pretty print data serialized in the bencode format. |
| homepage | |
| repository | https://github.com/P3KI/bendy |
| max_upload_size | |
| id | 1821286 |
| size | 27,765 |
A small CLI program to pretty print bencode. Just adds indentation and makes ascii-only byte strings print in a readable form. Built using the bendy crate.
Will only ingest valid bencode.
cargo install pretty-bencode
Can take a single bencode unit (list, dict, integer or byte string) from stdin.
echo "li1ei2ee" | pretty-bencode
l
i1e
i2e
e
Can take any number of bencode units, each from a different file.
pretty-bencode file1 file2 file3
Call with the --string-literal (-s) flag to print it formatted as a
rust string literal.
echo "li1ei2ee" | pretty-bencode -s
let pretty_bencode = b"\
l\
i1e\
i2e\
e\
"
If bytestrings contain only bytes that are printable ASCII (bytes in range 40 <= b < 127) they will be printed as ascii characters. Otherwise they will be printed in hexadecimal. E.g. a byte string containing only one byte with the value zero will be printed as 1:\x00. The 1: is of course the standard bencode byte string length prefix.