file

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanPatterns

func CleanPatterns(patterns []string) ([]string, [][]string, bool, error)

CleanPatterns takes a slice of patterns returns a new slice of patterns cleaned with filepath.Clean, stripped of any empty patterns and lets the caller know whether the slice contains any exception patterns (prefixed with !).

func CopyFile

func CopyFile(src, dst string) (int64, error)

CopyFile copies from src to dst until either EOF is reached on src or an error occurs. It verifies src exists and removes the dst if it exists.

func CreateIfNotExists

func CreateIfNotExists(path string, isDir bool) error

CreateIfNotExists creates a file or a directory only if it does not already exist.

func FileExists

func FileExists(file string) bool

FileExists exists filepath

func Matches

func Matches(file string, patterns []string) (bool, error)

Matches returns true if file matches any of the patterns and isn't excluded by any of the subsequent patterns.

func OptimizedMatches

func OptimizedMatches(file string, patterns []string, patDirs [][]string) (bool, error)

OptimizedMatches is basically the same as fileutils.Matches() but optimized for archive.go. It will assume that the inputs have been preprocessed and therefore the function doesn't need to do as much error checking and clean-up. This was done to avoid repeating these steps on each file being checked during the archive process. The more generic fileutils.Matches() can't make these assumptions.

func ReadSymlinkedDirectory

func ReadSymlinkedDirectory(path string) (string, error)

ReadSymlinkedDirectory returns the target directory of a symlink. The target of the symbolic link may not be a file.

func TarFile

func TarFile(src, dst string) error

func TgzFile

func TgzFile(src, dst string) error

func UnTarFile

func UnTarFile(targetFile, to string) error

func UnTgzFile

func UnTgzFile(targetFile, to string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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