MCPcopy Create free account
hub / github.com/anchordotdev/cli / ReadFile

Method ReadFile

truststore/fs.go:122–134  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

120}
121
122func (r *rootFS) ReadFile(name string) ([]byte, error) {
123 if err := r.checkFile(name); err != nil {
124 return nil, err
125 }
126
127 f, err := os.OpenFile(filepath.Join(r.rootPath, name), os.O_RDONLY, 0444)
128 if err != nil {
129 return nil, err
130 }
131 defer f.Close()
132
133 return io.ReadAll(f)
134}
135
136func (r *rootFS) checkFile(name string) error {
137 infoFS, err := r.StatFS.Stat(strings.Trim(name, string(os.PathSeparator)))

Callers 10

DetectMethod · 0.45
TestGoldenFunction · 0.45
installCAMethod · 0.45
installCAMethod · 0.45
CheckCAMethod · 0.45
ListCAsMethod · 0.45
UninstallCAMethod · 0.45
checkCAMethod · 0.45
installCAMethod · 0.45
listCAsMethod · 0.45

Calls 3

checkFileMethod · 0.95
ReadAllMethod · 0.65
CloseMethod · 0.45

Tested by 1

TestGoldenFunction · 0.36