Last active
January 14, 2021 12:56
-
-
Save jsidew/435c975e4e85d21502a6e43bda488734 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from (2020-01-14) https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader.DownloadWithIterator | |
svc := s3manager.NewDownloader(session) | |
fooFile, err := os.Open("/tmp/foo.file") | |
if err != nil { | |
return err | |
} | |
barFile, err := os.Open("/tmp/bar.file") | |
if err != nil { | |
return err | |
} | |
objects := []s3manager.BatchDownloadObject { | |
{ | |
Object: &s3.GetObjectInput { | |
Bucket: aws.String("bucket"), | |
Key: aws.String("foo"), | |
}, | |
Writer: fooFile, | |
}, | |
{ | |
Object: &s3.GetObjectInput { | |
Bucket: aws.String("bucket"), | |
Key: aws.String("bar"), | |
}, | |
Writer: barFile, | |
}, | |
} | |
iter := &s3manager.DownloadObjectsIterator{Objects: objects} | |
if err := svc.DownloadWithIterator(aws.BackgroundContext(), iter); err != nil { | |
return err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment