```ts
export function renderDataSize(total: number): string {
  if (!Number.isInteger(total) || total < 0) {
    throw new Error("Invalid byte count");
  }

  const ladder: [string, number][] = [
    ["TiB", 1099511627776],
    ["GiB", 1073741824],
    ["MiB", 1048576],
    ["KiB", 1024],
    ["B", 1],
  ];

  const parts: string[] = [];
  for (const [suffix, size] of ladder) {
    if (total >= size) {
      const count = Math.floor(total / size);
      parts.push(`${count}${suffix}`);
      total -= count * size;
    }
  }

  return parts.join(" ");
}
```