```ts
export function sizeUnit(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 String(Math.floor(bytesCount / 1024)) + " KB";
  }
  return String(Math.floor(bytesCount / (1000 * 1000))) + " 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 String(Math.floor(bytesCount / 1024)) + " KB";
  }
  return String(Math.floor(bytesCount / (1000 * 1000))) + " MB";
}
```