```ts
export function sizeUnit(bytesCount: number): string {
  if (bytesCount < 1) {
    throw new Error("a byte count cannot be negative");
  }
  const unit = sizeUnit(bytesCount);
  if (unit === "B") {
    return String(bytesCount) + " B";
  }
  if (unit === "KB") {
    return `${Math.floor(bytesCount / 1024)} KB`;
  }
  return `${Math.floor(bytesCount / (1024 * 1024))} MB`;
}

/** A byte count written in whole units. */
export function sizeText(bytesCount: number): string {
  if (bytesCount < 0) {
    throw new Error("a byte count cannot be negative");
  }
  const unit = sizeUnit(bytesCount);
  if (unit === "B") {
    return String(bytesCount) + " B";
  }
  if (unit === "KB") {
    return `${Math.floor(bytesCount / 1024)} KB`;
  }
  return `${Math.floor(bytesCount / (1024 * 1024))} MB`;
}
```