MCPcopy
hub / github.com/cortexlabs/cortex / ReadFileBytesErrPath

Function ReadFileBytesErrPath

pkg/lib/files/files.go:107–123  ·  view source on GitHub ↗
(path string, errMsgPath string)

Source from the content-addressed store, hash-verified

105}
106
107func ReadFileBytesErrPath(path string, errMsgPath string) ([]byte, error) {
108 path, err := EscapeTilde(path)
109 if err != nil {
110 return nil, err
111 }
112
113 if err := CheckFileErrPath(path, errMsgPath); err != nil {
114 return nil, err
115 }
116
117 fileBytes, err := ioutil.ReadFile(path)
118 if err != nil {
119 return nil, errors.Wrap(err, errors.Message(ErrorReadFile(errMsgPath)))
120 }
121
122 return fileBytes, nil
123}
124
125func CreateFile(path string) error {
126 cleanPath, err := EscapeTilde(path)

Callers 1

ReadFileBytesFunction · 0.85

Calls 5

WrapFunction · 0.92
MessageFunction · 0.92
EscapeTildeFunction · 0.85
CheckFileErrPathFunction · 0.85
ErrorReadFileFunction · 0.85

Tested by

no test coverage detected