rclone: github.com/ncw/rclone/fs/chunkedreader Index | Files

package chunkedreader

import "github.com/ncw/rclone/fs/chunkedreader"


Package Files



var (
    ErrorFileClosed  = errors.New("file already closed")
    ErrorInvalidSeek = errors.New("invalid seek position")

io related errors returned by ChunkedReader

type ChunkedReader Uses

type ChunkedReader struct {
    // contains filtered or unexported fields

ChunkedReader is a reader for an Object with the possibility of reading the source in chunks of given size

An initialChunkSize of <= 0 will disable chunked reading.

func New Uses

func New(ctx context.Context, o fs.Object, initialChunkSize int64, maxChunkSize int64) *ChunkedReader

New returns a ChunkedReader for the Object.

An initialChunkSize of <= 0 will disable chunked reading. If maxChunkSize is greater than initialChunkSize, the chunk size will be doubled after each chunk read with a maximum of maxChunkSize. A Seek or RangeSeek will reset the chunk size to it's initial value

func (*ChunkedReader) Close Uses

func (cr *ChunkedReader) Close() error

Close the file - for details see io.Closer

All methods on ChunkedReader will return ErrorFileClosed afterwards

func (*ChunkedReader) Open Uses

func (cr *ChunkedReader) Open() (*ChunkedReader, error)

Open forces the connection to be opened

func (*ChunkedReader) RangeSeek Uses

func (cr *ChunkedReader) RangeSeek(ctx context.Context, offset int64, whence int, length int64) (int64, error)

RangeSeek the file - for details see RangeSeeker

The specified length will only apply to the next chunk opened. RangeSeek will not reopen the source until Read is called.

func (*ChunkedReader) Read Uses

func (cr *ChunkedReader) Read(p []byte) (n int, err error)

Read from the file - for details see io.Reader

func (*ChunkedReader) Seek Uses

func (cr *ChunkedReader) Seek(offset int64, whence int) (int64, error)

Seek the file - for details see io.Seeker

Package chunkedreader imports 6 packages (graph) and is imported by 5 packages. Updated 2021-01-10. Refresh now. Tools for package owners.