formatFileSize method
Implementation
String formatFileSize() {
if (this < 1.KB) {
return format(fixed: 0, suffix: 'B');
} else if (this < 1.MB) {
return (this / 1.KB).format(fixed: 2, suffix: 'KB');
} else if (this < 1.GB) {
return (this / 1.MB).format(fixed: 2, suffix: 'MB');
} else if (this < 1.TB) {
return (this / 1.GB).format(fixed: 2, suffix: 'GB');
} else {
return (this / 1.TB).format(fixed: 2, suffix: 'TB');
}
}