MCPcopy
hub / github.com/ChineseSubFinder/ChineseSubFinder / GetFileSHA256String

Function GetFileSHA256String

pkg/util.go:660–676  ·  view source on GitHub ↗

GetFileSHA256String 获取文件的 SHA256 字符串

(fileFPath string)

Source from the content-addressed store, hash-verified

658
659// GetFileSHA256String 获取文件的 SHA256 字符串
660func GetFileSHA256String(fileFPath string) (string, error) {
661
662 fp, err := os.Open(fileFPath)
663 if err != nil {
664 return "", err
665 }
666 defer func() {
667 _ = fp.Close()
668 }()
669
670 partAll, err := io.ReadAll(fp)
671 if err != nil {
672 return "", err
673 }
674
675 return fmt.Sprintf("%x", sha256.Sum256(partAll)), nil
676}
677
678func GetRestOfDaySec() time.Duration {
679

Callers 3

dealOneVideoMethod · 0.92
scanLowVideoSubInfoMethod · 0.92
addLowVideoSubInfoMethod · 0.92

Calls 1

CloseMethod · 0.45

Tested by

no test coverage detected