mirror of
https://github.com/haorendashu/nowser.git
synced 2025-12-17 09:54:19 +01:00
13 lines
361 B
Dart
13 lines
361 B
Dart
class FileSizeUtil {
|
|
static String getFileSize(int fileSize) {
|
|
if (fileSize > 1024 * 1024 * 1024) {
|
|
return "${fileSize ~/ (1024 * 1024 * 1024)} GB";
|
|
} else if (fileSize > 1024 * 1024) {
|
|
return "${fileSize ~/ (1024 * 1024)} MB";
|
|
} else if (fileSize > 1024) {
|
|
return "${fileSize ~/ 1024} KB";
|
|
}
|
|
return "$fileSize B";
|
|
}
|
|
}
|