mirror of
https://github.com/tickstep/aliyunpan.git
synced 2025-01-23 22:42:15 +08:00
add file size percentage for upload & download command #236
This commit is contained in:
parent
85d79a9657
commit
12d866b28a
@ -209,9 +209,11 @@ func (dtu *DownloadTaskUnit) download() (err error) {
|
||||
}
|
||||
|
||||
if dtu.Cfg.ShowProgress {
|
||||
fmt.Fprintf(builder, "\r[%s] ↓ %s/%s %s/s(%s/s) in %s, left %s ............", dtu.taskInfo.Id(),
|
||||
downloadedPercentage := fmt.Sprintf("%.2f%%", float64(status.Downloaded())/float64(status.TotalSize())*100)
|
||||
fmt.Fprintf(builder, "\r[%s] ↓ %s/%s(%s) %s/s(%s/s) in %s, left %s ............", dtu.taskInfo.Id(),
|
||||
converter.ConvertFileSize(status.Downloaded(), 2),
|
||||
converter.ConvertFileSize(status.TotalSize(), 2),
|
||||
downloadedPercentage,
|
||||
converter.ConvertFileSize(status.SpeedsPerSecond(), 2),
|
||||
converter.ConvertFileSize(dtu.GlobalSpeedsStat.GetSpeeds(), 2),
|
||||
status.TimeElapsed()/1e7*1e7, leftStr,
|
||||
|
@ -179,9 +179,11 @@ func (utu *UploadTaskUnit) upload() (result *taskframework.TaskUnitRunResult) {
|
||||
}
|
||||
|
||||
if utu.ShowProgress {
|
||||
fmt.Printf("\r[%s] ↑ %s/%s %s/s(%s/s) in %s ............", utu.taskInfo.Id(),
|
||||
uploadedPercentage := fmt.Sprintf("%.2f%%", float64(status.Uploaded())/float64(status.TotalSize())*100)
|
||||
fmt.Printf("\r[%s] ↑ %s/%s(%s) %s/s(%s/s) in %s ............", utu.taskInfo.Id(),
|
||||
converter.ConvertFileSize(status.Uploaded(), 2),
|
||||
converter.ConvertFileSize(status.TotalSize(), 2),
|
||||
uploadedPercentage,
|
||||
converter.ConvertFileSize(status.SpeedsPerSecond(), 2),
|
||||
converter.ConvertFileSize(utu.GlobalSpeedsStat.GetSpeeds(), 2),
|
||||
status.TimeElapsed(),
|
||||
|
Loading…
Reference in New Issue
Block a user