计算文件的MD5哈希值
(&self, file_path: &Path)
| 37 | |
| 38 | /// 计算文件的MD5哈希值 |
| 39 | pub fn compute_file_md5(&self, file_path: &Path) -> Result<String, io::Error> { |
| 40 | let content = fs::read(file_path)?; |
| 41 | let hash = md5::compute(&content); |
| 42 | Ok(format!("{:x}", hash)) |
| 43 | } |
| 44 | |
| 45 | /// 检查文件是否需要更新 |
| 46 | pub fn needs_update(&self, file_path: &Path) -> Result<bool, io::Error> { |
no outgoing calls
no test coverage detected