Implemented filesystem endpoint with support for hardlinks, symlinks and copy.

This commit is contained in:
Clemens Rabe
2017-03-24 16:34:13 +01:00
parent ac475c0a10
commit 25f9c29f00
57 changed files with 1178 additions and 50 deletions
+17
View File
@@ -11,6 +11,23 @@ import (
"os"
)
// MD5ChecksumForFile computes just the MD5 hash and not all the others
func MD5ChecksumForFile(path string) (string, error) {
file, err := os.Open(path)
if err != nil {
return "", err
}
defer file.Close()
hash := md5.New()
_, err = io.Copy(hash, file)
if err != nil {
return "", err
}
return fmt.Sprintf("%x", hash.Sum(nil)), nil
}
// ChecksumInfo represents checksums for a single file
type ChecksumInfo struct {
Size int64