Documentation ¶
Index ¶
- Variables
- func ServeContent(ctx context.Context, w http.ResponseWriter, r *http.Request, name string, ...)
- type ByteRanger
- type FileReader
- type Ranger
- func Concat(r ...Ranger) Ranger
- func FileRanger(path string) (Ranger, error)
- func HTTPRanger(ctx context.Context, url string) (_ Ranger, err error)
- func HTTPRangerSize(url string, size int64) Ranger
- func ReaderAtRanger(r io.ReaderAt, size int64) Ranger
- func Subrange(data Ranger, offset, length int64) (Ranger, error)
Constants ¶
This section is empty.
Variables ¶
var Error = errs.Class("ranger error")
Error is the errs class of standard Ranger errors
Functions ¶
Types ¶
type ByteRanger ¶
type ByteRanger []byte
ByteRanger turns a byte slice into a Ranger
func (ByteRanger) Range ¶
func (b ByteRanger) Range(ctx context.Context, offset, length int64) (_ io.ReadCloser, err error)
Range implements Ranger.Range
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
FileReader implements limit reader with io.EOF only on last read.
func (*FileReader) Close ¶
func (reader *FileReader) Close() error
Close closes the underlying file.
type Ranger ¶
type Ranger interface { Size() int64 Range(ctx context.Context, offset, length int64) (io.ReadCloser, error) }
A Ranger is a flexible data stream type that allows for more effective pipelining during seeking. A Ranger can return multiple parallel Readers for any subranges.
func FileRanger ¶
FileRanger returns a Ranger from a path.
func HTTPRanger ¶
HTTPRanger turns an HTTP URL into a Ranger
func HTTPRangerSize ¶
HTTPRangerSize creates an HTTPRanger with known size. Use it if you know the content size. This will safe the extra HEAD request for retrieving the content size.
func ReaderAtRanger ¶
ReaderAtRanger converts a ReaderAt with a given size to a Ranger