-(NSString *) convertFileSize:(long long)size {
long kb = 1024;
long mb = kb * 1024;
long gb = mb * 1024;
if (size >= gb) {
return [NSString stringWithFormat:@"%.1f GB", (float) size / gb];
} else if (size >= mb) {
float f = (float) size / mb;
if (f > 100) {
return [NSString stringWithFormat:@"%.0f MB", f];
}else{
return [NSString stringWithFormat:@"%.1f MB", f];
}
} else if (size >= kb) {
float f = (float) size / kb;
if (f > 100) {
return [NSString stringWithFormat:@"%.0f KB", f];
}else{
return [NSString stringWithFormat:@"%.1f KB", f];
}
} else
return [NSString stringWithFormat:@"%lld B", size];
}