pub fn total_bytes(ranges: &ChunkRanges, size: Option<u64>) -> u64
Get the number of bytes given a set of chunk ranges and the total size.
If some ranges are out of bounds, they will be clamped to the size.