MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / ReadFile

Method ReadFile

application/statics/embed.go:331–341  ·  view source on GitHub ↗

ReadFile reads and returns the content of the named file.

(name string)

Source from the content-addressed store, hash-verified

329
330// ReadFile reads and returns the content of the named file.
331func (f FS) ReadFile(name string) ([]byte, error) {
332 file, err := f.Open(name)
333 if err != nil {
334 return nil, err
335 }
336 ofile, ok := file.(*openFile)
337 if !ok {
338 return nil, &fs.PathError{Op: "read", Path: name, Err: errors.New("is a directory")}
339 }
340 return []byte(ofile.f.data), nil
341}
342
343// An openFile is a regular file open for reading.
344type openFile struct {

Callers 6

AddTorrentMethod · 0.80
AddMetalinkMethod · 0.80
GetMasterKeyMethod · 0.80
masterkey.goFile · 0.80
loadStateMethod · 0.80
getBuildTimeFunction · 0.80

Calls 2

OpenMethod · 0.95
NewMethod · 0.65

Tested by

no test coverage detected