Documentation ¶
Index ¶
- func ConcatFiles(filePaths ...string) (io.Reader, error)
- func ConvertJSONArrayToYAML(jsonContent string) (string, error)
- func ConvertJSONMapToYAML(jsonContent string) (string, error)
- func ConvertYAMLArrayToJSON(yamlContent string) (string, error)
- func ConvertYAMLMapToJSON(yamlContent string) (string, error)
- func CopyReaderToTemporaryFile(prefix string, name string, r io.Reader) (string, error)
- func GarbageCollectTemporaryFiles(tempDir string, mask string, n int) ([]string, error)
- func LoadJSONFile(path string, target interface{}) error
- func LoadYAMLFile(path string, target interface{}) error
- func WriteTemporaryFile(prefix string, name string, body []byte) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConcatFiles ¶ added in v0.5.8
ConcatFiles creates an io.Reader that reads from the provided files in order.
func ConvertJSONArrayToYAML ¶
func ConvertJSONMapToYAML ¶
func ConvertYAMLArrayToJSON ¶
func ConvertYAMLMapToJSON ¶
func CopyReaderToTemporaryFile ¶ added in v0.4.36
CopyReaderToTemporaryFile creates a temporary file with a given prefix, name and copies data from a reader into it.
In the event of any errors during the file creation or data copying, it cleans up by deleting the file and returns the error.
Returns the path to the temporary file on success.
func GarbageCollectTemporaryFiles ¶ added in v0.4.25
GarbageCollectTemporaryFiles deletes the oldest files in a directory based on a given mask, leaving only 'n' newest files. It returns a slice of paths of the deleted files. It requires read and write permissions on the directory. If it encounters a file that it cannot delete, it will stop and return the files it has deleted so far along with the error.
func LoadJSONFile ¶
func LoadYAMLFile ¶
func WriteTemporaryFile ¶ added in v0.4.36
WriteTemporaryFile creates a temporary file with a given prefix, name and writes data into it.
In the event of any errors, it cleans up by deleting the file and returns the error.
Returns: Path of the temp file and error if any.
Types ¶
This section is empty.