/**
 * 换算数据大小
 * @param {Number} size
 * @returns String
 */
export function conversionSize(size) {
  let _size = size;
  const units = ['B', 'KB', 'MB', 'GB'];
  let factor = 0;
  while (_size > 1024 && factor < units.length - 1) {
    _size /= 1024;
    factor += 1;
  }
  return `${_size.toFixed(2)}${units[factor]}`;
}
