MCPcopy
hub / github.com/cloudfoundry/cli / ComputeFileSha1

Method ComputeFileSha1

util/checksum.go:40–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (c *sha1Checksum) ComputeFileSha1() ([]byte, error) {
41 hash := sha1.New()
42
43 f, err := os.Open(c.filepath)
44 if err != nil {
45 return []byte{}, err
46 }
47 defer f.Close()
48
49 if _, err := io.Copy(hash, f); err != nil {
50 return []byte{}, err
51 }
52
53 return hash.Sum(nil), nil
54}
55
56func (c *sha1Checksum) SetFilePath(filepath string) {
57 c.filepath = filepath

Callers 1

CheckSha1Method · 0.95

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected