util

package
v0.0.0-...-3f99f61 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: MIT, Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Copier

type Copier struct {
	Recursive bool
	Ignore    []string
}

Copier copies files from one path to another. Not recursive by default. Optional list of patterns to ignore via `strings.Contains`.

func (Copier) Copy

func (c Copier) Copy(from, to string) error

Copy files `from` into `to`.

type CopyBuffer

type CopyBuffer struct {
	// Cursor tracks progress through the buffer between read calls.
	Cursor int
	// Data is the underlying data to copy out.
	Data []byte
}

CopyBuffer is a copy-on-read buffer.

func NewCopyBuffer

func NewCopyBuffer(buffer []byte) *CopyBuffer

NewCopyBuffer allocates a copy buffer seeded by the provided byte slice.

func (*CopyBuffer) Read

func (b *CopyBuffer) Read(p []byte) (int, error)

Read until EOF. Subsequent reads will reset to the start of the buffer.

type Finder

type Finder struct {
	// Root folder to start search from.
	Root string
	// IsDir if we are looking for a directory.
	IsDir bool
	// Rel indicates to return a relative path instead of an absolute path.
	Rel bool
}

Finder finds files by name.

func (Finder) Find

func (f Finder) Find(name string) (string, error)

Find the first file with the given name recursively from the root.

Returns the absolute path to the file, or an error if something went wrong while walking the file system.

If path is empty then no file was found.

type MultiError

type MultiError []error

MultiError combines a number of errors into a single error value.

func (MultiError) Error

func (me MultiError) Error() string

func (*MultiError) FromChan

func (me *MultiError) FromChan(errs chan error) *MultiError

func (MultiError) IsEmpty

func (me MultiError) IsEmpty() bool

Jump to

Keyboard shortcuts

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