fix(139): upload failed (#2950)
fix: The file size is exceeded and cannot be uploaded fix: File name has special characters, signature fails improve: optimize memory usage Signed-off-by: aimuz <mr.imuz@gmail.com> Signed-off-by: aimuz <mr.imuz@gmail.com>
This commit is contained in:
@ -105,3 +105,23 @@ type PutResult interface {
|
||||
}
|
||||
|
||||
type UpdateProgress func(percentage int)
|
||||
|
||||
type Progress struct {
|
||||
Total int64
|
||||
Done int64
|
||||
up UpdateProgress
|
||||
}
|
||||
|
||||
func (p *Progress) Write(b []byte) (n int, err error) {
|
||||
n = len(b)
|
||||
p.Done += int64(n)
|
||||
p.up(int(float64(p.Done) / float64(p.Total) * 100))
|
||||
return
|
||||
}
|
||||
|
||||
func NewProgress(total int64, up UpdateProgress) *Progress {
|
||||
return &Progress{
|
||||
Total: total,
|
||||
up: up,
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user