How do I go from io.ReadCloser to io.ReadSeeker?

I’m trying to download a file from S3 and upload that file to another bucket in S3. Copy API won’t work here because I’ve been told not to use it.

Getting an object from S3 has a response.Body that’s an io.ReadCloser and to upload that file, the payload takes a Body that’s an io.ReadSeeker .

The only way I can figure this out is by saving the response.Body to a file then passing that file as a io.ReadSeeker . This would require writing the entire file to disk first then reading the entire file from disk which sounds pretty wrong.

What I would like to do is:

resp, _ := conn.GetObject(&s3.GetObjectInput{Key: "bla"})
conn.PutObject(&s3.PutObjectInput{Body: resp.Body}) // resp.Body is an io.ReadCloser and the field type expects an io.ReadSeeker

Question is, how do I go from an io.ReadCloser to an io.ReadSeeker in the most efficient way possible?