mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: progressively update image size while uploading
This commit is contained in:
@@ -26,7 +26,7 @@ type SStreamProperty struct {
|
||||
Size int64
|
||||
}
|
||||
|
||||
func StreamPipe(reader io.Reader, writer io.Writer, CalChecksum bool) (*SStreamProperty, error) {
|
||||
func StreamPipe(reader io.Reader, writer io.Writer, CalChecksum bool, callback func(saved int64)) (*SStreamProperty, error) {
|
||||
sp := SStreamProperty{}
|
||||
|
||||
var md5sum hash.Hash
|
||||
@@ -50,6 +50,9 @@ func StreamPipe(reader io.Reader, writer io.Writer, CalChecksum bool) (*SStreamP
|
||||
}
|
||||
offset += m
|
||||
}
|
||||
if callback != nil {
|
||||
callback(sp.Size)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
|
||||
Reference in New Issue
Block a user