Skip to main content

Module inspector_bytes

Module inspector_bytes 

Source
Expand description

What a binary value holds, told from its first bytes, and the text in it where that is cheap to get: UTF-8 stored as bytes, or gzip and zstd of text. Nothing here runs or renders what it finds; decompression stops at DECODE_MAX bytes of output, whatever the input claims.

Structs§

Decoded
Text decoded from bytes: what it came from, and whether it was cut at DECODE_MAX.

Enums§

Sniffed
A kind of content, named from its magic bytes.

Constants§

DECODE_MAX
The most text decoded from a value: a decompression bomb stops here.

Functions§

decode_text
The text in bytes: themselves when they are UTF-8, or what gzip or zstd decompress them to, up to DECODE_MAX bytes. None when there is no text.
sniff
What bytes hold, from the bytes alone. UTF-8 is text that decodes whole and has no NUL in it.