Logo
Explore Help
Register Sign In
immich-app/immich
1
0
Fork 0
You've already forked immich
mirror of https://github.com/immich-app/immich.git synced 2025-12-17 09:13:17 +03:00
Code Issues Packages Projects Releases 16 Wiki Activity
Files
d3bc92c3f89dda6e000e978d70ffa619147d6a06
immich/mobile/lib/utils/bytes_units.dart

18 lines
400 B
Dart
Raw Normal View History

Better caching for mobile (#521) * Use custom caches in all modules * Cache Settings * Fix wrong key * Create custom cache repository based on hive * Show cache usage in settings * Show cache sizes * Change settings ranges and default value * Handle cache clear by operating system * Resolve review comments
2022-08-30 05:44:43 +02:00
String formatBytes(int bytes) {
feat(server,web,mobile): Use binary prefixes for data sizes (#1009)
2022-11-25 06:39:27 +13:00
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB'];
int magnitude = 0;
double remainder = bytes.toDouble();
while (remainder >= 1024) {
if (magnitude + 1 < units.length) {
magnitude++;
remainder /= 1024;
}
else {
break;
}
Better caching for mobile (#521) * Use custom caches in all modules * Cache Settings * Fix wrong key * Create custom cache repository based on hive * Show cache usage in settings * Show cache sizes * Change settings ranges and default value * Handle cache clear by operating system * Resolve review comments
2022-08-30 05:44:43 +02:00
}
feat(server,web,mobile): Use binary prefixes for data sizes (#1009)
2022-11-25 06:39:27 +13:00
return "${remainder.toStringAsFixed(magnitude == 0 ? 0 : 1)} ${units[magnitude]}";
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.2 Page: 58ms Template: 3ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API