mirror of
https://github.com/keven1024/015.git
synced 2026-06-08 21:34:33 +00:00
chore(backend): replace go-units with go-humanize for improved file size handling
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
goUnits "github.com/docker/go-units"
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
)
|
||||
|
||||
func GetFileId(fileHash string, fileSize int64) string {
|
||||
@@ -48,7 +48,6 @@ func GetUploadDirPath() (string, error) {
|
||||
return uploadPath, nil
|
||||
}
|
||||
|
||||
func GetFileSize(size string) (int64, error) {
|
||||
s, err := goUnits.FromHumanSize(size)
|
||||
return s, err
|
||||
func GetFileSize(size string) (uint64, error) {
|
||||
return humanize.ParseBytes(size)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user