MCPcopy Index your code
hub / github.com/dnote/dnote / ReadFileAbs

Function ReadFileAbs

pkg/cli/utils/files.go:28–40  ·  view source on GitHub ↗

ReadFileAbs reads the content of the file with the given file path by resolving it as an absolute path

(relpath string)

Source from the content-addressed store, hash-verified

26// ReadFileAbs reads the content of the file with the given file path by resolving
27// it as an absolute path
28func ReadFileAbs(relpath string) []byte {
29 fp, err := filepath.Abs(relpath)
30 if err != nil {
31 panic(err)
32 }
33
34 b, err := os.ReadFile(fp)
35 if err != nil {
36 panic(err)
37 }
38
39 return b
40}
41
42// FileExists checks if the file exists at the given path
43func FileExists(filepath string) (bool, error) {

Callers 3

TestMigrateToV6Function · 0.92
TestMigrateToV7Function · 0.92
InitTestMemoryDBRawFunction · 0.92

Calls

no outgoing calls

Tested by 2

TestMigrateToV6Function · 0.74
TestMigrateToV7Function · 0.74