fileutils

package
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FUInitializer

type FUInitializer interface {
	NewFileutils(partDir string, prefixParts string, log logger.LoggerInterface) FileInterface
}

type FileInterface

type FileInterface interface {
	PathExists(path string) bool
}

type FileOperator

type FileOperator interface {
	Remove(name string) error
	Create(name string) (*os.File, error)
	ReadFile(name string) ([]byte, error)
	Open(name string) (*os.File, error)
	WriteFile(filename string, data []byte, perm os.FileMode) error
	WriteEncryptedFile(filename string, data []byte, key []byte, perm os.FileMode) error
}

type FileUtilsInitImpl

type FileUtilsInitImpl struct {
}

func (*FileUtilsInitImpl) NewFileutils

func (fu *FileUtilsInitImpl) NewFileutils(partsDir string, prefixParts string, log logger.LoggerInterface) FileInterface

type Fileutils

type Fileutils struct {
	PartsDir    string
	PrefixParts string
	Log         logger.LoggerInterface
}

func NewFileutils

func NewFileutils(partsDir string, prefixParts string, log logger.LoggerInterface) *Fileutils

func (*Fileutils) CombinedMD5HashForPrefixedFiles

func (f *Fileutils) CombinedMD5HashForPrefixedFiles(dir string, prefix string) (string, error)

func (*Fileutils) CreateFile

func (f *Fileutils) CreateFile(filePath string) (*os.File, error)

func (*Fileutils) EnsureAppRoot

func (f *Fileutils) EnsureAppRoot() (string, error)

func (*Fileutils) ExtractPathAndFilename

func (f *Fileutils) ExtractPathAndFilename(path string) (string, string, error)

ExtractDirFilename extracts the directory and filename from a given path.

func (*Fileutils) LoadConfig

func (f *Fileutils) LoadConfig(v *viper.Viper, configName string, configPath string) error

func (*Fileutils) PathExists

func (f *Fileutils) PathExists(path string) bool

func (*Fileutils) ProcessPartsDir

func (f *Fileutils) ProcessPartsDir() error

func (*Fileutils) RemoveExtensions

func (f *Fileutils) RemoveExtensions(filename string) string

func (*Fileutils) RemovePartsOrDirectory

func (f *Fileutils) RemovePartsOrDirectory(u *utils.Utils, keepParts bool, partsDir string, appRoot string, prefixParts string) error

func (*Fileutils) SetLogger

func (f *Fileutils) SetLogger(log logger.LoggerInterface)

func (*Fileutils) ValidateCreatePath

func (f *Fileutils) ValidateCreatePath(path string) error

func (*Fileutils) ValidatePath

func (f *Fileutils) ValidatePath(path string) (string, error)

ValidatePath checks if the given path adheres to our constraints.

type RealFileUtils

type RealFileUtils struct {
	Init *Fileutils
}

func (*RealFileUtils) PathExists

func (fu *RealFileUtils) PathExists(path string) bool

Jump to

Keyboard shortcuts

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