fileutil

package
v0.6.27 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDir added in v0.3.29

func CopyDir(src, dst string) error

CopyDir recursively copies the directory tree rooted at src into dst, preserving file modes. dst is created if it does not exist.

func CopyDirFiltered added in v0.3.29

func CopyDirFiltered(src, dst string, include func(relPath string, d os.DirEntry) bool) error

CopyDirFiltered recursively copies the directory tree rooted at src into dst, preserving file modes. When include is non-nil it is consulted with each entry's path relative to src; entries it rejects are skipped (for a directory, the whole subtree).

Only directories and regular files are copied. Anything else (symlinks, devices) fails loudly: silently dropping or dereferencing an entry would produce a copy that looks complete but is not.

func CopyFile added in v0.3.29

func CopyFile(src, dst string) error

CopyFile copies a single regular file from src to dst, preserving the file mode. The destination's parent directory must already exist.

func ExtractZip added in v0.3.29

func ExtractZip(zipPath, destDir string) error

ExtractZip extracts a zip archive into destDir, creating directories as needed and preserving file modes. Entries whose paths would escape destDir (zip slip) are rejected.

func IsDirExists

func IsDirExists(d string) bool

IsDirExists check if a directory exists

func IsExists

func IsExists(filePath string) (bool, error)

func RenderTemplate

func RenderTemplate(input interface{}, templateString string) ([]byte, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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