mitchellh / goamz

Golang Amazon Library
Other
672 stars 216 forks source link

s3 partial get #235

Open anacrolix opened 9 years ago

anacrolix commented 9 years ago

S3 purported supports Range requests, but there's no way to specify these in Bucket.Get and friends. Perhaps a GetHeader method or similar is required?

frodopwns commented 8 years ago

Does this method do what you want? https://godoc.org/github.com/mitchellh/goamz/s3#Bucket.Head

anacrolix commented 8 years ago

Nah, HEAD requests are something else altogether, but thanks.

skiz commented 7 years ago

I'm looking for the same thing. Unfortunately this function doesn't allow adding path or header params, and getResponseParams is a private method.

func (b *Bucket) GetResponse(path string) (*http.Response, error) {
    return b.getResponseParams(path, nil)
}

To achieve this, we need to be able to set custom headers on GET requests. ""The S3 APIs support the HTTP Range: header (see RFC 2616), which take a byte range argument. Just add a Range: bytes=0-NN header to your S3 request""

To add this functionality along with other custom functionality, adding GetReaderHeader which is similar to PutReaderHeader should solve this issue and be flexible enough for users to provide whatever headers they want.