Documentation
¶
Index ¶
- func ExistsAndIsDirectory(path string) (exists, isDir bool, err error)
- func ReadOrPanic(p string) []byte
- func SafeReadFile(filePath string, perm os.FileMode) ([]byte, error)
- func SafeReadJSON(filePath string, targetPointer any, perm os.FileMode) (jsonAvailable bool, err error)
- func SafeReadYAML(filePath string, targetPointer any, perm os.FileMode) (yamlAvailable bool, err error)
- func SafeWriteJson[T any](filePath string, targetPointer *T) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExistsAndIsDirectory ¶
func ReadOrPanic ¶
ReadOrPanic reads the entire file at the provided path or panics if it is not possible.
func SafeReadFile ¶
SafeReadFile reads the file at the provided path into a byte slice.
func SafeReadJSON ¶
func SafeReadJSON(filePath string, targetPointer any, perm os.FileMode) (jsonAvailable bool, err error)
SafeReadJSON reads the JSON file at the path into the targetPointer. Returns true if the file exists or an error if an error occurred.
func SafeReadYAML ¶
func SafeReadYAML(filePath string, targetPointer any, perm os.FileMode) (yamlAvailable bool, err error)
SafeReadYAML reads the YAML file at the path into the targetPointer. Returns true if the file exists or an error if an error occurred.
func SafeWriteJson ¶
SafeWriteJson writes the provided object to a JSON file at the provided path. The function makes sure any changes are flushed to the disk before returning.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.