Implement pack importing/exporting for downloaded Curseforge packs

Abstract out hash implementations
Implement file saving/downloading
This commit is contained in:
comp500
2019-11-12 22:11:40 +00:00
parent 73f6184b3d
commit 5dfe23e51d
12 changed files with 749 additions and 297 deletions

View File

@@ -1,7 +1,6 @@
package core
import (
"crypto/sha256"
"encoding/hex"
"errors"
"io"
@@ -65,7 +64,10 @@ func (pack *Pack) UpdateIndexHash() error {
// Hash usage strategy (may change):
// Just use SHA256, overwrite existing hash regardless of what it is
// May update later to continue using the same hash that was already being used
h := sha256.New()
h, err := GetHashImpl("sha256")
if err != nil {
return err
}
if _, err := io.Copy(h, f); err != nil {
return err
}