This commit is contained in:
Yuri Trikoz
2020-06-21 15:20:40 +03:00
parent 179ab2c3bf
commit 40688130fd
10 changed files with 246 additions and 183 deletions

View File

@@ -85,3 +85,14 @@ boolean isDigitStr(const String& str) {
}
return str.length();
}
String prettyBytes(size_t size) {
if (size < 1024)
return String(size) + "b";
else if (size < (1024 * 1024))
return String(size / 1024.0) + "kB";
else if (size < (1024 * 1024 * 1024))
return String(size / 1024.0 / 1024.0) + "MB";
else
return String(size / 1024.0 / 1024.0 / 1024.0) + "GB";
}