7 Commits

Author SHA1 Message Date
7a9cd55fb2 Merge pull request '[🚀] 64KB' (#7) from dev into main
Reviewed-on: #7
2024-08-09 15:40:23 +08:00
0185a00836 [🚀] 64KB 2024-08-09 15:39:57 +08:00
4d7668c9ff Merge pull request 'dev' (#6) from dev into main
Reviewed-on: #6
2024-08-09 15:35:20 +08:00
e65d101476 [🚀] 64KB 2024-08-09 15:34:51 +08:00
0ce7678c21 [🚀] 64KB 2024-08-09 15:31:29 +08:00
c08b4bf90d Merge pull request '[🚀] region' (#5) from dev into main
Reviewed-on: #5
2024-08-06 10:16:19 +08:00
74e88e62d5 [🚀] region 2024-08-06 10:15:56 +08:00
3 changed files with 7 additions and 7 deletions

View File

@ -260,7 +260,7 @@ func (f *Fetcher) fetchChunk(index int) (err error) {
return err
}
var buf = make([]byte, 8192)
var buf = make([]byte, 64*1024) // 64KB
// 重试10次
for i := 0; i < 10; i++ {

View File

@ -56,12 +56,11 @@ type PutRet struct {
User string `json:"user"`
}
func New(accessKey, secretKey, bucket, domain, securityKey string, region *storage.Region) QiNiu {
func New(accessKey, secretKey, bucket, domain, securityKey string) QiNiu {
mac := qbox.NewMac(accessKey, secretKey)
conf := &storage.Config{
Region: region, //空间所在的存储区域
UseHTTPS: true, //是否使用https域名
UseCdnDomains: false, //上传是否使用CDN上传加速
UseHTTPS: true, //是否使用https域名
UseCdnDomains: false, //上传是否使用CDN上传加速
}
return &qiNiu{
mac: mac,

View File

@ -5,6 +5,7 @@ import (
"bytes"
"errors"
"fmt"
"github.com/spf13/cast"
"io"
"math"
"math/rand"
@ -33,7 +34,7 @@ func GetOrderNumber() string {
// ByteFmt 格式化显示文件大小
func ByteFmt(size int64) string {
var unitArr = []string{"B", "KB", "MB", "GB", "TB", "EB"}
if size == 0 {
if size <= 0 {
return "unknown"
}
fs := float64(size)
@ -43,7 +44,7 @@ func ByteFmt(size int64) string {
if frac > 0 {
return fmt.Sprintf("%.1f%s", math.Floor(val*10)/10, unitArr[p])
} else {
return fmt.Sprintf("%d%s", int(val), unitArr[p])
return fmt.Sprintf("%d%s", cast.ToInt(val), unitArr[p])
}
}