copier

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Filename string
	Line     int
}

type Copier

type Copier interface {
	Context() Context
	SetContext(ctx Context)

	Copy(wp *WriteProgress) error
	BytesWritten() uint64
	Dest() string
	DebugPrint() string
}

func MakeCopierFromString

func MakeCopierFromString(line, srcPath, destPath string) (Copier, error)

type HTTPFile

type HTTPFile struct {
	// contains filtered or unexported fields
}

func (*HTTPFile) BytesWritten

func (f *HTTPFile) BytesWritten() uint64

func (*HTTPFile) Context

func (f *HTTPFile) Context() Context

func (*HTTPFile) Copy

func (f *HTTPFile) Copy(wp *WriteProgress) error

func (*HTTPFile) DebugPrint

func (f *HTTPFile) DebugPrint() string

func (*HTTPFile) Dest

func (f *HTTPFile) Dest() string

func (*HTTPFile) SetContext

func (f *HTTPFile) SetContext(ctx Context)

type LocalFile

type LocalFile struct {
	// contains filtered or unexported fields
}

func (*LocalFile) BytesWritten

func (f *LocalFile) BytesWritten() uint64

func (*LocalFile) Context

func (f *LocalFile) Context() Context

func (*LocalFile) Copy

func (f *LocalFile) Copy(wp *WriteProgress) error

func (*LocalFile) DebugPrint

func (f *LocalFile) DebugPrint() string

func (*LocalFile) Dest

func (f *LocalFile) Dest() string

func (*LocalFile) SetContext

func (f *LocalFile) SetContext(ctx Context)

type WriteProgress

type WriteProgress struct {
	// contains filtered or unexported fields
}

WriteProgress counts the number of bytes written to it. It implements to the io.Writer (and thus goes well with io.TeeReader). If freq time has passed, then it calls the given func.

func NewWriteProgress

func NewWriteProgress(freq time.Duration, fn func(uint64, uint64)) WriteProgress

func (*WriteProgress) BytesWritten

func (wp *WriteProgress) BytesWritten() uint64

func (*WriteProgress) SetGoal

func (wp *WriteProgress) SetGoal(n uint64)

func (*WriteProgress) Write

func (wp *WriteProgress) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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