filesystem utility¶
- group turbo_files_utility
Functions
-
turbo::ResultStatus<std::string> md5_sum_file(const std::string_view &path, int64_t *size = nullptr)¶
get file md5 sum.
Note
use the result of this function should check the status of the operation first. if the status is not ok, the result is invalid.
auto rs = FileUtility::md5_sum_file("test.txt"); if (rs.ok()) { std::cout << rs.value() << std::endl; // do something else. } else { std::cout << rs.status().message() << std::endl; // do something else. }
- Parameters:
path – [input] file path
size – [output] file size that is calculated.
- Returns:
md5 sum of the file and the status of the operation.
-
turbo::ResultStatus<std::string> sha1_sum_file(const std::string_view &path, int64_t *size = nullptr)¶
get file sha1 sum.
Note
use the result of this function should check the status of the operation first. if the status is not ok, the result is invalid.
auto rs = FileUtility::sha1_sum_file("test.txt"); if (rs.ok()) { std::cout << rs.value() << std::endl; // do something else. } else { std::cout << rs.status().message() << std::endl; // do something else. }
- Parameters:
path – [input] file path
size – [output] file size that is calculated.
- Returns:
sha1 sum of the file and the status of the operation.
-
turbo::ResultStatus<std::string> md5_sum_file(const std::string_view &path, int64_t *size = nullptr)¶