Download downloads a file from S3 into memory
(key string)
| 69 | |
| 70 | // Download downloads a file from S3 into memory |
| 71 | func (s *s3) Download(key string) ([]byte, error) { |
| 72 | buff := &aws.WriteAtBuffer{} |
| 73 | input := awss3.GetObjectInput{ |
| 74 | Key: aws.String(key), |
| 75 | Bucket: aws.String(s.bucket), |
| 76 | } |
| 77 | |
| 78 | _, err := s.downloader.Download(buff, &input) |
| 79 | if err != nil { |
| 80 | return nil, err |
| 81 | } |
| 82 | |
| 83 | return buff.Bytes(), nil |
| 84 | } |
| 85 | |
| 86 | // List lists a set of files from a given S3 path. |
| 87 | // Works only for one level deep sub-paths. |