MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / fileSHA256

Function fileSHA256

pkg/go/cmd/codebase-memory-mcp/main.go:1053–1066  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

1051}
1052
1053func fileSHA256(path string) ([sha256.Size]byte, error) {
1054 var digest [sha256.Size]byte
1055 source, err := os.Open(path)
1056 if err != nil {
1057 return digest, err
1058 }
1059 defer source.Close()
1060 hash := sha256.New()
1061 if _, err := io.Copy(hash, source); err != nil {
1062 return digest, err
1063 }
1064 copy(digest[:], hash.Sum(nil))
1065 return digest, nil
1066}
1067
1068func filesEqualSHA256(left, right string) (bool, error) {
1069 leftInfo, err := os.Lstat(left)

Callers 5

filesEqualSHA256Function · 0.85
copyRuntimeBackupFileFunction · 0.85
pathMatchesSHA256Function · 0.85

Calls 1

CloseMethod · 0.80

Tested by

no test coverage detected