goamz icon indicating copy to clipboard operation
goamz copied to clipboard

s3 partial get

Open anacrolix opened this issue 9 years ago • 3 comments

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?

anacrolix avatar Feb 27 '15 11:02 anacrolix

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

frodopwns avatar Jan 10 '16 16:01 frodopwns

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

anacrolix avatar Jan 11 '16 11:01 anacrolix

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.

skiz avatar Jul 25 '17 18:07 skiz