uproot.serialization.bytestring

Defined in uproot.serialization on line 30.

uproot.serialization.bytestring(data)

Converts Python bytes into a length-prefixed bytestring, ready to be written to a file.

If the string’s byte representation (UTF-8) has fewer than 255 bytes, it is preceded by a 1-byte length; otherwise, it is preceded by b'ÿ' and a 4-byte length.