Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSeqRangingClient ¶ added in v0.6.0
func NewSeqRangingClient(ranger Ranger, client *http.Client) http.RoundTripper
func NewSeqReader ¶ added in v0.6.0
func NewSeqReader(client *http.Client, url string, ranger SizedRanger) io.ReadSeekCloser
NewSeqReader returns a new io.ReadSeekCloser that reads from the given url using the given client. Instead of reading the whole file at once, it reads the file in sequential chunks, using the given ranger to determine the ranges to read. This allows for reading very large files in CDN-cacheable chunks using RANGE GETs.
Types ¶
type ByteRange ¶
ByteRange represents a range of bytes available in a file
func (ByteRange) RangeHeader ¶ added in v0.2.0
RangeHeader returns the HTTP header representation of the byte range, suitable for use in the Range header, as described in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range
type Ranger ¶
type Ranger struct {
// contains filtered or unexported fields
}
Ranger can split a file into chunks of a given size.
func NewRanger ¶
NewRanger creates a new Ranger with the given chunk size. If the chunk size is <= 0, the default chunk size is used.
type SizedRanger ¶ added in v0.6.0
type SizedRanger struct {
// contains filtered or unexported fields
}
func NewSizedRanger ¶ added in v0.6.0
func NewSizedRanger(length int64, ranger Ranger) SizedRanger
func (SizedRanger) Length ¶ added in v0.6.0
func (r SizedRanger) Length() int64
func (SizedRanger) RangeContaining ¶ added in v0.7.0
func (r SizedRanger) RangeContaining(offset int64) (br ByteRange)