MCPcopy Create free account
hub / github.com/driangle/taskmd / HashLocalFile

Function HashLocalFile

apps/cli/internal/sync/hash.go:25–32  ·  view source on GitHub ↗

HashLocalFile returns the SHA-256 hash of a file's contents.

(path string)

Source from the content-addressed store, hash-verified

23
24// HashLocalFile returns the SHA-256 hash of a file's contents.
25func HashLocalFile(path string) (string, error) {
26 data, err := os.ReadFile(path)
27 if err != nil {
28 return "", err
29 }
30 h := sha256.Sum256(data)
31 return fmt.Sprintf("%x", h[:]), nil
32}

Callers 7

createTaskMethod · 0.85
acceptLocalMethod · 0.85
recreateMissingFileMethod · 0.85
applyExternalUpdateMethod · 0.85
localFileChangedMethod · 0.85
TestHashLocalFileFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestHashLocalFileFunction · 0.68