Skip to content

Commit

Permalink
review: add example for get-object with context
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Auernhammer committed Sep 26, 2017
1 parent 233c413 commit cb19676
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/s3/getobject-context.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
defer cancel()

reader, err := s3Client.GetObjectWithContext(ctx, "my-bucketname", "my-objectname", minio.GetObjectOptions{})
opts := minio.GetObjectOptions{}
opts.SetModified(time.Now().Sub(10*time.Minute)) // get object if was modified within the last 10 minutes
reader, err := s3Client.GetObjectWithContext(ctx, "my-bucketname", "my-objectname", opts)
if err != nil {
log.Fatalln(err)
}
Expand Down

0 comments on commit cb19676

Please sign in to comment.