seekinghttp

package module
Version: v0.0.0-...-f41d11c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2017 License: BSD-3-Clause Imports: 8 Imported by: 3

README

seekinghttp

An implementation of io.ReaderAt that works via GET and the Range header.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SeekingHTTP

type SeekingHTTP struct {
	URL    string
	Client *http.Client
	Debug  bool
	// contains filtered or unexported fields
}

SeekingHTTP uses a series of HTTP GETs with Range headers to implement io.ReadSeeker and io.ReaderAt.

func New

func New(url string) *SeekingHTTP

New initializes a SeekingHTTP for the given URL. The SeekingHTTP.Client field may be set before the first call to Read or Seek.

func (*SeekingHTTP) Read

func (s *SeekingHTTP) Read(buf []byte) (int, error)

func (*SeekingHTTP) ReadAt

func (s *SeekingHTTP) ReadAt(buf []byte, off int64) (int, error)

ReadAt reads len(buf) bytes into buf starting at offset off.

func (*SeekingHTTP) Seek

func (s *SeekingHTTP) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read.

func (*SeekingHTTP) Size

func (s *SeekingHTTP) Size() (int64, error)

Size uses an HTTP HEAD to find out how many bytes are available in total.

Source Files

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL