MCPcopy Create free account
hub / github.com/activecm/rita / GetFileContents

Function GetFileContents

util/util.go:378–392  ·  view source on GitHub ↗

GetFileContents reads the contents of a file at the specified path

(afs afero.Fs, path string)

Source from the content-addressed store, hash-verified

376
377// GetFileContents reads the contents of a file at the specified path
378func GetFileContents(afs afero.Fs, path string) ([]byte, error) {
379 // validate file
380 err := ValidateFile(afs, path)
381 if err != nil {
382 return nil, err
383 }
384
385 // get file contents
386 file, err := readFile(afs, path)
387 if err != nil {
388 return nil, err
389 }
390
391 return file, nil
392}
393
394// CheckForNewerVersion checks if a newer version of the project is available on the GitHub repository
395func CheckForNewerVersion(client *github.Client, currentVersion string) (bool, string, error) {

Callers 3

ReadFileConfigFunction · 0.92
ReadTestFileConfigFunction · 0.92
TestGetFileContentsFunction · 0.85

Calls 1

ValidateFileFunction · 0.85

Tested by 1

TestGetFileContentsFunction · 0.68