files

package
v1.24.8 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: Apache-2.0 Imports: 17 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src string, dst string) error

Copy a file from src to dst

func CopyFromReader

func CopyFromReader(src io.Reader, dst string, mode os.FileMode) (int64, error)

func Exists

func Exists(path string) bool

Exists returns true if the file exists

func GetBaseName

func GetBaseName(filename string) string

GetBaseName returns the base part of the filename without the extension

func Getter

func Getter(url, dst string) error

Getter gets a directory or file using the Hashicorp go-getter library See https://github.com/hashicorp/go-getter

func GzipFile

func GzipFile(path string) ([]byte, error)

GzipFile takes the path to a file and returns a Gzip comppressed byte slice

func IsValidPathType added in v1.5.5

func IsValidPathType(input string, extensions ...string) bool

func SafeRead

func SafeRead(path string) string

SafeRead reads a path and returns the text contents or nil

func TempFileName

func TempFileName(prefix, suffix string) string

TempFileName generates a temporary filename for

func Unarchive

func Unarchive(src, dest string) error

Unarchive extracts the contents of an archive to the dest directory

func UnarchiveExecutables

func UnarchiveExecutables(src, dest string) error

UnarchiveExecutables extracts all executable's to the dest directory, ignoring any path's specified by the archive

func UnfoldGlobs added in v1.18.0

func UnfoldGlobs(paths ...string) ([]string, error)

func Ungzip

func Ungzip(source, target string) error

Ungzip the source file to the target directory

func Untar

func Untar(tarball, target string) error

Untar extracts all files in tarball to the target directory

func UntarWithFilter

func UntarWithFilter(tarball, target string, filter FileFilter) error

UntarWithFilter extracts all files in tarball to the target directory, passing each file to filter if the filter returns "" then the file is ignored, otherwise the return string is used as the relative destination path

func Unxz added in v1.5.11

func Unxz(source, target string) error

func Unzip

func Unzip(src, dest string) error

Unzip the source file to the target directory

func Zip added in v1.6.2

func Zip(src, dst string) error

Zip the source file/directory into the target destination

Types

type FileFilter

type FileFilter func(header os.FileInfo) string

FileFilter is a function used for filtering files

Jump to

Keyboard shortcuts

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