mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-10 06:14:22 +00:00
Implemented filesystem endpoint with support for hardlinks, symlinks and copy.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user