Files
cos-cpp-sdk-v5/include/util/file_util.h
a158 3cf88acc07 BG
2026-04-05 20:22:11 +08:00

32 lines
996 B
C++

#ifndef COS_CPP_SDK_V5_INCLUDE_UTIL_FILE_UTIL_H_
#define COS_CPP_SDK_V5_INCLUDE_UTIL_FILE_UTIL_H_
#include <stdint.h>
#include <fstream>
#include <iostream>
#include <string>
namespace qcloud_cos {
class FileUtil {
public:
// 获取文件内容
static std::string GetFileContent(const std::string& path);
// 获取文件大小
static uint64_t GetFileLen(const std::string& path);
static bool IsDirectoryExists(const std::string& path);
static bool IsDirectory(const std::string& path);
static std::string GetDirectory(const std::string& path);
// 获取文件CRC64
static uint64_t GetFileCrc64(const std::string& file);
#if defined(_WIN32)
static uint64_t GetFileLen(const std::wstring& path);
static uint64_t GetFileCrc64(const std::wstring& file);
static std::wstring GetWideCharFilePath(const std::string file_path);
#endif
static std::string GetFileMd5(const std::string& file);
};
} // namespace qcloud_cos
#endif // COS_CPP_SDK_V5_INCLUDE_UTIL_FILE_UTIL_H_