Documentation
¶
Index ¶
- func AppendToFile(path string, data []byte) error
- func CopyWithProgress(dst io.Writer, src io.Reader, progressFn func(written int64)) (int64, error)
- func DirExists(path string) bool
- func FileExists(path string) bool
- func MultiReadCloser(readers ...io.ReadCloser) io.ReadCloser
- func ReadFileString(path string) (string, error)
- func SafeClose(c io.Closer) error
- func WalkFiles(root string, walkFn func(path string, info fs.FileInfo) error) error
- func WriteFileWithDirs(path string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToFile ¶
AppendToFile appends data to a file, creating the file if it doesn't exist.
func CopyWithProgress ¶
CopyWithProgress copies data from src to dst, reporting progress periodically. It returns the number of bytes copied and the first error encountered, if any.
func FileExists ¶
FileExists checks if a file exists and is not a directory.
func MultiReadCloser ¶
func MultiReadCloser(readers ...io.ReadCloser) io.ReadCloser
MultiReadCloser returns an io.ReadCloser that's the logical concatenation of the provided input readers. They're read sequentially, and Close() closes all readers.
func ReadFileString ¶
ReadFileString reads the entire contents of a file and returns it as a string. If the file cannot be read, it returns an error.
func SafeClose ¶
SafeClose attempts to close the closer and returns the error if any. It's useful in defer statements where you might want to track the close error.
Types ¶
This section is empty.