refactor: rename encode method
This commit is contained in:
parent
5ba0111d08
commit
2dc9d4dcf6
|
@ -5,7 +5,7 @@ import (
|
||||||
"github.com/multiformats/go-multibase"
|
"github.com/multiformats/go-multibase"
|
||||||
)
|
)
|
||||||
|
|
||||||
func EncodeHashSimple(hash [32]byte, size uint64) (string, error) {
|
func Encode(hash [32]byte, size uint64) (string, error) {
|
||||||
sizeBytes := make([]byte, 8)
|
sizeBytes := make([]byte, 8)
|
||||||
binary.LittleEndian.PutUint64(sizeBytes, size)
|
binary.LittleEndian.PutUint64(sizeBytes, size)
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (f *FilesService) PostUpload() {
|
||||||
|
|
||||||
hashBytes := blake3.Sum256(buf)
|
hashBytes := blake3.Sum256(buf)
|
||||||
hashHex := hex.EncodeToString(hashBytes[:])
|
hashHex := hex.EncodeToString(hashBytes[:])
|
||||||
fileCid, err := cid.EncodeHashSimple(hashBytes, uint64(meta.Size))
|
fileCid, err := cid.Encode(hashBytes, uint64(meta.Size))
|
||||||
|
|
||||||
if internalError(ctx, err) {
|
if internalError(ctx, err) {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue