Documentation ¶
Index ¶
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, 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