Skip to main content

Module bytes

Module bytes 

Source
Expand description

Binary-data helpers: the base64 JSON envelope and the hex dump.

kaish is UTF-8 text end to end, so binary values must be encoded the moment they cross a text boundary. Two encodings, two boundaries:

  • base64 envelope — how a Value::Bytes / a binary result serializes for --json and MCP. Self-describing so an agent can act on it: {"_type":"bytes","encoding":"base64","data":"…","len":N}.
  • hex dump — how binary renders for a human (REPL): xxd-style offset / hex columns / ASCII gutter.

See docs/binary-data.md.

Constants§

BYTES_ENVELOPE_TYPE
The _type discriminator marking a base64 byte envelope.

Functions§

bytes_to_envelope
Encode raw bytes as the self-describing base64 JSON envelope.
envelope_to_bytes
Recognize the base64 byte envelope and decode it back to raw bytes.
hex_dump
Render bytes as an xxd-style hex dump for human display.