filesys

package
v0.25.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectFilesWithExt

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

func ComputeDirectoryHash

func ComputeDirectoryHash(dir string) (string, error)

func ComputeFileChecksum

func ComputeFileChecksum(filePath string) (string, error)

func CopyFS

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

copyFS copies files and directories from srcFS to destRoot securely.

func CopyFile

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

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

func OpenZipFile

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

func ReadJSON

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

func ReplaceWithCopy

func ReplaceWithCopy(src, dst string) error

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

func ReplaceWithMove

func ReplaceWithMove(src, dst string) error

func SecureUntar

func SecureUntar(src string, dest string) error

Secure untar function

func SecureUnzip

func SecureUnzip(src string, dest string) error

Secure unzip function

func WriteJSON

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

Types

type CopyConfig

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

type CopyOption

type CopyOption func(*CopyConfig)

func WithOverwrite

func WithOverwrite(overwrite bool) CopyOption

func WithPreservePermissions

func WithPreservePermissions(preserve bool) CopyOption

func WithRoot

func WithRoot(root string) CopyOption

Jump to

Keyboard shortcuts

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