cop

package
v1.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MaxBufferSize int = 512

Will ChunkyCopy in chunks this size at max.

Variables

View Source
var CopyDirError = errors.New("cannot operate on dir, see CopyOperation.Copy")

Functions

func ChunkyCopy

func ChunkyCopy(src, dst string, bufsize int) error

The raw copy function. Opens [src], creates [dst] (overwriting whatever is there with an empty file) and copies bytes in chunks of [bufsize] until complete.

func Copy

func Copy(src, dst string, overwrite bool) error

Does not respect directories. Excepts [src] to be a regular file, otherwise returns CopyDirError.

If [src] and [dst] are the same according to [FileInfo.Equals], or [dst] was modified after [src] (and [overwrite] is false), we will fail.

Types

type CopyOperation

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

func New

func New(src, dst string) *CopyOperation

func (*CopyOperation) Copy

func (co *CopyOperation) Copy(overwrite bool) error

Accounts for directories - when we are sure that we're handling regular files, Copy takes over.

func (*CopyOperation) Destination

func (co *CopyOperation) Destination() string

func (*CopyOperation) From

func (co *CopyOperation) From(path string) *CopyOperation

func (*CopyOperation) Source

func (co *CopyOperation) Source() string

func (CopyOperation) String

func (co CopyOperation) String() string

func (*CopyOperation) To

func (co *CopyOperation) To(path string) *CopyOperation

Jump to

Keyboard shortcuts

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