Calculate the metered size in bytes of a record (append or read). This includes the body and headers, but not metadata like timestamp.
This function calculates how many bytes the record will occupy after being received and deserialized as raw bytes on the S2 side. For strings, it calculates UTF-8 byte length. For Uint8Array, it uses the array length directly (same value as would be used when encoding to base64 for transmission).
The record to measure
The size in bytes
Low-level utilities for record bodies.