function convertBytes(bytes) {
  var targetUnit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'MB';
  var units = {
    B: 1,
    KB: 1024,
    MB: Math.pow(1024, 2),
    GB: Math.pow(1024, 3),
    TB: Math.pow(1024, 4)
  };
  var unit = targetUnit.toUpperCase();
  if (!(units !== null && units !== void 0 && units[unit]) || typeof bytes !== 'number') {
    return 0;
  }
  return bytes / units[unit];
}
export default convertBytes;