Documentation ¶
Index ¶
- Constants
- func CleanPath(path string) string
- func CollectHashes(files []FileInfo, singleThread bool, minSize int, algorithm string, flat bool) map[string][]FileInfo
- func GetAlgorithm(al string) string
- func GetDuplicates(hashes map[string][]FileInfo) ([][]FileInfo, int, int)
- func GetFileHash(path, algorithm string) (string, error)
- func RemoveDuplicates(fileSets [][]FileInfo) (int, int, error)
- type FileInfo
Constants ¶
const ( XXHash = "xxhash" MD5 = "md5" SHA256 = "sha256" )
Variables ¶
This section is empty.
Functions ¶
func CollectHashes ¶
func CollectHashes(files []FileInfo, singleThread bool, minSize int, algorithm string, flat bool) map[string][]FileInfo
CollectHashes returns hashes for the given files A hash will be the key and a list of FileInfo for files that share the hash as the value "singleThread=false" will force all the function to use one thread only minSize is the minimum file size to scan "flat=true" will tell the function not to print out any data other than the path to duplicate files algorithm is the algorithm to calculate the hash with
func GetAlgorithm ¶
GetAlgorithm matches the given string to one of the supported algorithms Returns md5 if a match wasn't found
func GetDuplicates ¶
GetDuplicates scans the given map of hashes and finds the one with duplicates It will return a slice containing slices with each slice containing paths to duplicate files It will also returns the total of duplicate files and the total of files that have duplicates
func GetFileHash ¶
GetFileHash returns given file hash using the provided algorithm Default: md5