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

Method shaFile

cf/appfiles/app_files.go:68–82  ·  view source on GitHub ↗
(fullPath string)

Source from the content-addressed store, hash-verified

66}
67
68func (appfiles ApplicationFiles) shaFile(fullPath string) (string, error) {
69 hash := sha1.New()
70 file, err := os.Open(fullPath)
71 if err != nil {
72 return "", err
73 }
74 defer file.Close()
75
76 _, err = io.Copy(hash, file)
77 if err != nil {
78 return "", err
79 }
80
81 return fmt.Sprintf("%x", hash.Sum(nil)), nil
82}
83
84func (appfiles ApplicationFiles) CopyFiles(appFiles []models.AppFileFields, fromDir, toDir string) error {
85 for _, file := range appFiles {

Callers 1

AppFilesInDirMethod · 0.95

Calls 1

CloseMethod · 0.65

Tested by

no test coverage detected