Skip to content

Commit

Permalink
Update download.go
Browse files Browse the repository at this point in the history
Improve Downloader.Download(..) documentation according aws#482 and aws#483
  • Loading branch information
vvelikodny authored Mar 13, 2021
1 parent d02b7c4 commit 99c834f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions feature/s3/manager/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func WithDownloaderClientOptions(opts ...func(*s3.Options)) func(*Downloader) {
// }
//
// // Create an S3 client using the loaded configuration
// s3.NewFromConfig(cfg)
// s3.NewFromConfig(cfg)
//
// // Create a downloader passing it the S3 client
// downloader := manager.NewDownloader(s3.NewFromConfig(cfg))
Expand Down Expand Up @@ -148,7 +148,15 @@ func NewDownloader(c DownloadAPIClient, options ...func(*Downloader)) *Downloade
// options that will be applied to all API operations made with this downloader.
//
// The w io.WriterAt can be satisfied by an os.File to do multipart concurrent
// downloads, or in memory []byte wrapper using aws.WriteAtBuffer.
// downloads, or in memory []byte wrapper using aws.WriteAtBuffer. In case you download
// files into memory do not forget to pre-allocate memory to avoid additional allocations
// and GC runs.
//
// Example:
// // pre-allocate in memory buffer, where headObject type is *s3.HeadObjectOutput
// buf := make([]byte, int(headObject.ContentLength))
// // wrap with aws.WriteAtBuffer
// w := s3manager.NewWriteAtBuffer(w)
//
// Specifying a Downloader.Concurrency of 1 will cause the Downloader to
// download the parts from S3 sequentially.
Expand Down

0 comments on commit 99c834f

Please sign in to comment.