MCPcopy Index your code
hub / github.com/1Panel-dev/1Panel / GetFileMD5

Function GetFileMD5

core/utils/files/files.go:303–315  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

301}
302
303func GetFileMD5(filePath string) (string, error) {
304 file, err := os.Open(filePath)
305 if err != nil {
306 return "", err
307 }
308 defer file.Close()
309 hash := md5.New()
310
311 if _, err = io.Copy(hash, file); err != nil {
312 return "", err
313 }
314 return hex.EncodeToString(hash.Sum(nil)), nil
315}

Callers

nothing calls this directly

Calls 2

CopyMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected