filesys

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectFilesWithExt added in v0.17.0

func CollectFilesWithExt(root, ext string) ([]string, error)

func ComputeDirectoryHash added in v0.17.0

func ComputeDirectoryHash(dir string) (string, error)

func ComputeFileChecksum added in v0.14.0

func ComputeFileChecksum(filePath string) (string, error)

func CopyFS added in v0.17.0

func CopyFS(srcFS fs.FS, destRoot string, options ...CopyOption) error

copyFS copies files and directories from srcFS to destRoot securely.

func CopyFile added in v0.17.0

func CopyFile(srcFS fs.FS, srcPath, destPath string, perm fs.FileMode) error

copyFile copies a single file from srcFS to destPath, preserving permissions.

func GetBaseName

func GetBaseName(fileName string) string

GetBaseName Get filename without extension.

func GetDirName

func GetDirName(filePath string) string

func OpenTarFile added in v0.17.0

func OpenTarFile(source string, fpath string) ([]byte, error)

func OpenZipFile

func OpenZipFile(source string, fpath string) ([]byte, error)

func ReadJSON added in v0.17.0

func ReadJSON(fName string, v interface{}) error

func ReplaceWithCopy added in v0.17.0

func ReplaceWithCopy(src, dst string) error

Copy directory from src to dst remove dst repository if it exists

func ReplaceWithMove added in v0.17.0

func ReplaceWithMove(src, dst string) error

func SecureUntar added in v0.17.0

func SecureUntar(src string, dest string) error

Secure untar function

func SecureUnzip added in v0.17.0

func SecureUnzip(src string, dest string) error

Secure unzip function

func WriteJSON added in v0.17.0

func WriteJSON(fName string, v interface{}) error

Types

type CopyConfig added in v0.17.0

type CopyConfig struct {
	RootDir      string // Root directory to copy
	Overwrite    bool   // Override existing files
	PreservePerm bool   // Preserve file permissions
}

type CopyOption added in v0.17.0

type CopyOption func(*CopyConfig)

func WithOverwrite added in v0.17.0

func WithOverwrite(overwrite bool) CopyOption

func WithPreservePermissions added in v0.17.0

func WithPreservePermissions(preserve bool) CopyOption

func WithRoot added in v0.17.0

func WithRoot(root string) CopyOption

Jump to

Keyboard shortcuts

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