function formatBytes(bytes) {
  let unit = 'MiB';
  let size = Math.round(bytes / (1024 * 1024));

  if (size > 1024) {
    unit = 'GiB';
    size = (size / 1024).toFixed(2);
  }

  return `${size} ${unit}`;
}
// Formats the given byte size, depending on how large it is.
Formats the given byte size, depending on how large it is.
Formats the given byte size depending on how large it is .
function formatBytes(bytes) {
  let unit = 'MiB';
  let size = Math.round(bytes / (1024 * 1024));
  if (size > 1024) {
    unit = 'GiB';
    size = (size / 1024).toFixed(2);
  }
  return `${size} ${unit}`;
}
function formatBytes ( bytes ) { let unit = 'MiB' ; let size = Math . round ( bytes / ( 1024 * 1024 ) ) ; if ( size > 1024 ) { unit = 'GiB' ; size = ( size / 1024 ) . toFixed ( 2 ) ; } return ` ${ size } ${ unit } ` ; }
Formats the given byte size, depending on how large it is.
Formats the given byte size depending on how large it is .