filecopy

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir

func CopyDir(dst, src string, copier Copier) error

CopyDir will recursively copy all files from the source path over to the destination path. Both dst and src are expected to be existing directories, and then all content of one directory is copied into the other.

Only files and directories are copied. Any sockets, devices, symlinks, or other file types are silently ignored.

func CopyDirIgnorer

func CopyDirIgnorer(dst, src string, copier Copier, ignorer ignorer.Ignorer) error

CopyDirIgnorer will recursively copy all files from the source path over to the destination path. Both dst and src are expected to be existing directories, and then all content of one directory is copied into the other.

The passed ignorer is used to conditionally omit files or directory trees from the copy operation.

Only files and directories are copied. Any sockets, devices, symlinks, or other file types are silently ignored.

func CopyFile

func CopyFile(dst, src string, copier Copier) error

CopyFile takes a destination and source path and copies the content via the copier implementation.

Types

type Copier

type Copier interface {
	Copy(dst io.Writer, src io.Reader) error
}

Copier is an interface that can copy bytes from one reader to a writer.

var IOCopier Copier = ioCopier{}

IOCopier is a copier implementation that uses the built-in io.Copy() to copy the content in a loop.

Jump to

Keyboard shortcuts

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