From 5c3a997de438515f3ba14d7e297e72360cc35a7a Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Wed, 19 Jul 2023 20:38:05 +0530 Subject: [PATCH] make beautifyFileSize public This general function will be useful in other kiwix apps --- include/tools.h | 9 +++++++++ src/tools/stringTools.h | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/tools.h b/include/tools.h index 9ea7f89dc..5ba923cc9 100644 --- a/include/tools.h +++ b/include/tools.h @@ -216,5 +216,14 @@ std::map getNetworkInterfaces(); */ std::string getBestPublicIp(); +/** Converts file size to human readable format. + * + * This function will convert a number to its equivalent size using units. + * + * @param number file size in bytes. + * @return a human-readable string representation of the size, e.g., "2.3 KB", "1.8 MB", "5.2 GB". + */ +std::string beautifyFileSize(uint64_t number); + } #endif // KIWIX_TOOLS_H diff --git a/src/tools/stringTools.h b/src/tools/stringTools.h index af0527f29..14fed7574 100644 --- a/src/tools/stringTools.h +++ b/src/tools/stringTools.h @@ -31,7 +31,6 @@ namespace kiwix { std::string beautifyInteger(uint64_t number); -std::string beautifyFileSize(uint64_t number); void printStringInHexadecimal(const char* s); void printStringInHexadecimal(icu::UnicodeString s); void stringReplacement(std::string& str,