Documentation
¶
Overview ¶
ddcio include helper code for io operations common to ddc
ddcio include helper code for io operations common to ddc
Index ¶
- func CalculateFileHash(file string) ([]byte, error)
- func CompareFiles(file1, file2 string) (bool, error)
- func CopyDir(src, dst string) error
- func CopyFile(srcPath, dstPath string) error
- func DeleteDirContents(dir string) error
- func EnsureClose(fileName string, f func() error)
- func GetFilesInDir(dir string) ([]os.DirEntry, error)
- func GzipFile(src, dst string) error
- func Shell(writer io.Writer, commandLine string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateFileHash ¶
CalculateFileHash calculates the MD5 hash value for the given file. It opens the file, reads its contents, and computes the hash value. The calculated hash value is returned as a slice of bytes. An error is returned if there is a problem opening or reading the file.
func CompareFiles ¶
CompareFiles checks if two files have the same content by comparing their hash values. It returns true if the files have the same content, or false otherwise. An error is returned if there is a problem reading the files or calculating the hashes.
func CopyDir ¶
CopyDir recursively copies a source directory to a destination. It does not copy file attributes, but does maintain directory structure. If the destination directory does not exist, CopyDir creates it. If a file with the same name exists at the destination, CopyDir overwrites it.
func DeleteDirContents ¶
func EnsureClose ¶
EnsureClose logs a failure when the close does not succeed this should not be used with "just in case closes" and should indeed signal an error
func GetFilesInDir ¶
GetFilesInDir retrieves a list of directory entries for the given directory. It returns a slice of os.DirEntry representing the files and subdirectories in the directory. An error is returned if there is a problem reading the directory.
Types ¶
This section is empty.