ddcio

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

ddcio include helper code for io operations common to ddc

ddcio include helper code for io operations common to ddc

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateFileHash

func CalculateFileHash(file string) ([]byte, error)

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

func CompareFiles(file1, file2 string) (bool, error)

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

func CopyDir(src, dst string) error

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 CopyFile

func CopyFile(srcPath, dstPath string) error

func DeleteDirContents

func DeleteDirContents(dir string) error

func GetFilesInDir

func GetFilesInDir(dir string) ([]os.DirEntry, error)

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.

func GzipFile

func GzipFile(src, dst string) error

func Shell

func Shell(writer io.Writer, commandLine string) error

Shell executes a shell command with shell expansion and appends its output to the provided io.Writer.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL