fileutil

package
v0.40.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyEmbedDir added in v0.16.0

func CopyEmbedDir(fs embed.FS, src, dst string) error

CopyEmbedDir copies an embedded directory to the local file system.

func CopyToTempFile

func CopyToTempFile(r io.Reader, name, ext string) (string, int64, error)

CopyToTempFile pipes a reader to a temporary file. The caller must delete the temporary file when it's no longer needed.

func ExpandHome added in v0.19.0

func ExpandHome(path string) (string, error)

func ForceRemoveFiles added in v0.19.0

func ForceRemoveFiles(paths []string)

ForceRemoveFiles deletes multiple files ignores path errors if any

func FullExt

func FullExt(path string) string

FullExt returns all of path's extensions. For example, for "foo.csv.zip" it returns ".csv.zip", not just ".zip" as filepath.Ext from the standard library does.

func IsGlob added in v0.19.0

func IsGlob(path string) bool

IsGlob reports whether path contains any of the magic characters recognized by path.Match.

func OpenTempFileInDir added in v0.21.0

func OpenTempFileInDir(dir, filePath string) (*os.File, error)

OpenTempFileInDir opens a temp file in given dir If dir doesn't exist it creates full dir path (recursively if required)

func ResolveLocalPath added in v0.32.0

func ResolveLocalPath(path, root string, allowHostAccess bool) (string, error)

func Stem added in v0.16.0

func Stem(path string) string

Stem returns the file name after removing directory and all extensions. Uses FullExt to strip extensions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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