Skip to content

Commit

Permalink
s3: Add progress tracker support to s3 downloads (#334)
Browse files Browse the repository at this point in the history
This was oddly missing entirely and I was real sad. It seems to only be
supported on HTTP right now.
  • Loading branch information
mattrobenolt authored Aug 16, 2021
1 parent c926030 commit 790e6b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion get_s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,15 @@ func (g *S3Getter) getObject(ctx context.Context, client *s3.S3, dst, bucket, ke
return err
}

return copyReader(dst, resp.Body, 0666, g.client.umask())
body := resp.Body

if g.client != nil && g.client.ProgressListener != nil {
fn := filepath.Base(key)
body = g.client.ProgressListener.TrackProgress(fn, 0, *resp.ContentLength, resp.Body)
}
defer body.Close()

return copyReader(dst, body, 0666, g.client.umask())
}

func (g *S3Getter) getAWSConfig(region string, url *url.URL, creds *credentials.Credentials) *aws.Config {
Expand Down

0 comments on commit 790e6b3

Please sign in to comment.