Created
May 25, 2016 13:00
-
-
Save csmith0651/c37f84e3119a08738c826811ab39cce0 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
func downloadS3Data(fetcher S3Fetcher, bucket string, key string) ([]byte, error) { | |
results, err := fetcher.GetObject(&s3.GetObjectInput{ | |
Bucket: aws.String(bucket), | |
Key: aws.String(key), | |
}) | |
if err != nil { | |
return nil, err | |
} | |
defer results.Body.Close() | |
buf := bytes.NewBuffer(nil) | |
if _, err := io.Copy(buf, results.Body); err != nil { | |
return nil, err | |
} | |
return buf.Bytes(), nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment