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

Function OpenFile

pkg/lib/files/files.go:65–77  ·  view source on GitHub ↗

the returned file should be closed by the caller

(path string, flag int, perm os.FileMode)

Source from the content-addressed store, hash-verified

63
64// the returned file should be closed by the caller
65func OpenFile(path string, flag int, perm os.FileMode) (*os.File, error) {
66 cleanPath, err := EscapeTilde(path)
67 if err != nil {
68 return nil, err
69 }
70
71 file, err := os.OpenFile(cleanPath, flag, perm)
72 if err != nil {
73 return nil, errors.Wrap(err, errors.Message(ErrorCreateFile(path)))
74 }
75
76 return file, err
77}
78
79// the returned file should be closed by the caller
80func Create(path string) (*os.File, error) {

Callers 2

UntarReaderToDirFunction · 0.92
UnzipFileToDirFunction · 0.92

Calls 4

WrapFunction · 0.92
MessageFunction · 0.92
EscapeTildeFunction · 0.85
ErrorCreateFileFunction · 0.85

Tested by

no test coverage detected