MCPcopy Index your code
hub / github.com/devspace-sh/devspace / File

Function File

pkg/util/hash/hash.go:28–42  ·  view source on GitHub ↗

File creates the hash value of a file

(path string)

Source from the content-addressed store, hash-verified

26
27// File creates the hash value of a file
28func File(path string) (string, error) {
29 file, err := os.Open(path)
30 if err != nil {
31 return "", err
32 }
33 defer file.Close()
34
35 hash := sha256.New()
36 _, err = io.Copy(hash, file)
37 if err != nil {
38 return "", err
39 }
40
41 return hex.EncodeToString(hash.Sum(nil)), nil
42}
43
44// Directory creates the hash value of a directory
45func Directory(path string) (string, error) {

Callers 1

downloadSyncHelperFunction · 0.92

Calls 2

CloseMethod · 0.65
CopyMethod · 0.65

Tested by

no test coverage detected