Documentation
¶
Index ¶
- Constants
- Variables
- func Archive(conf *ArchiveConfig) error
- func DefaultFileDecryption(passwd []byte, fileList []string) error
- func DefaultFileEncryption(passwd []byte, fileList []string) error
- func DefaultPathWalkerFunc(fileList *[]string) filepath.WalkFunc
- func Extract(conf *ExtractConfig) error
- func FileDecryption(key []byte, encFileName, decFileName string)
- func FileEncryption(bytKey []byte, inFileName, encFileName string)
- func ListFiles(pathToWalk string, walkFuncBuilder walkFuncBuilder) ([]string, error)
- func PushToGIT(gitRepo string, args ...gitChain) error
- func RunTestCases(s SuiteRunner, testCases []TestCase)
- type ArchiveConfig
- type BlockSize
- type ExtractConfig
- type PathConfig
- type SuiteRunner
- type TestCase
Constants ¶
const ( // BlockSizeByte - Byte representative character. BlockSizeByte = BlockSize(letterB) // BlockSizeKB - KB representative character. BlockSizeKB = BlockSize(letterK) // BlockSizeMB - MB representative character. BlockSizeMB = BlockSize(letterM) // BlockSizeGB - GB representative character. BlockSizeGB = BlockSize(letterG) )
Variables ¶
var ( // ErrNotDir - path is not a directory. // Currently only archiving dirs has been thoroughly tested. ErrNotDir = errors.New("path is not a directory") // ErrPathEmpty - path can not be empty. ErrPathEmpty = errors.New("path can not be empty") )
var ErrCmdWrapFn = func(cmd, cmdArgs string, err error) error { cmdSlc := strings.Fields(cmdArgs) return fmt.Errorf("%s: failed executing the command with args[%v]: %w", cmd, cmdSlc, err) }
ErrCmdWrapFn - func used to wrap errors caused by executeCommand, if any.
Functions ¶
func Archive ¶
func Archive(conf *ArchiveConfig) error
Archive - used to create archive zip volume(s) from a chosen directory.
func DefaultFileDecryption ¶ added in v0.0.4
DefaultFileDecryption -- represents basic usage of the FileDecryption func.
func DefaultFileEncryption ¶ added in v0.0.4
DefaultFileEncryption - represents basic usage of the FileEncryption func.
func DefaultPathWalkerFunc ¶ added in v0.0.12
DefaultPathWalkerFunc - returns default implementation of filepath.WalkFunc.
This approach enables the flexibility to override the filepath.WalkFunc used by our ListFiles func.
func Extract ¶ added in v0.0.2
func Extract(conf *ExtractConfig) error
Extract - used to extract the archive(s).
func FileDecryption ¶ added in v0.0.4
FileDecryption - decrypt a file.
func FileEncryption ¶ added in v0.0.4
FileEncryption - encrypt a file.
func RunTestCases ¶ added in v0.0.12
func RunTestCases(s SuiteRunner, testCases []TestCase)
RunTestCases - func executing the passed testing Suite.
Types ¶
type ArchiveConfig ¶ added in v0.0.3
type ArchiveConfig struct {
// PathConfig - embeds required path information for archiving process.
PathConfig
// Password - if set, it will be used to encrypt the archive.
Password []byte
// ArchiveType - default setting '-t7z'.
ArchiveType string
// BlockSize - default setting 'm' [BlockSizeMB].
BlockSize BlockSize // b,k,m,g - size representation
// VolumeSize - default setting '-v9m' - representing volumes of 9Megabytes each.
VolumeSize uint64
// FastBytes - default setting '-mfb=64', where the number set represents the number of Fast bytes for LZMA.
FastBytes uint16
// DictSize - default setting '-md=64m.
DictSize uint16
// ApplyPassword - if true, then password flag for 7zip cmd will be used.
ApplyPassword bool
// HeadersEncryption - default setting '-mhe=on'. Enables Headers encryption.
HeadersEncryption bool // -he=on
// Compression - default setting '-mx=9', where 9 represents Ultra and 0 would be none compression at all.
Compression uint8
// SolidArchive - default setting '-ms=on'
SolidArchive bool
}
ArchiveConfig - represents the config required for the archiving process.
If it's not provided, then default one will be used. Note that default setting is 'Ultra' (highest compression). This config will be just append-only, to keep API consistency. Preferred over params in order to avoid breaking API with future updates.
func NewDefaultArchiveConfig ¶ added in v0.0.3
func NewDefaultArchiveConfig() ArchiveConfig
NewDefaultArchiveConfig - returns ArchiveConfig with default values pre-set.
Note that default setting is 'Ultra' (highest compression).
type BlockSize ¶
type BlockSize string
BlockSize - represents size of the volume blocks in b|k|m|g.
func DetermineBlockSize ¶
DetermineBlockSize - returns BlockSize casted from an input string.
type ExtractConfig ¶ added in v0.0.2
type ExtractConfig struct {
// Password - if set, it will be used to decrypt the archive.
Password []byte
// ExtractPath - path which points to the directory to archive(s) location (for extraction).
ExtractPath string
}
ExtractConfig - represents configuration which is required for 7zip extraction process.
type PathConfig ¶ added in v0.0.3
type PathConfig struct {
// PathToArchive - path which points to the directory which should be archived.
// Should be relative to the current working dir.
PathToArchive string
// OutputPath - path where the temporary archive files should be placed.
OutputPath string
// NewArchiveName - if set it will represent the base for the name of output archive(s).
NewArchiveName string
}
PathConfig - path config required for the archiving process.
type SuiteRunner ¶ added in v0.0.12
SuiteRunner - interface for running testing Suite.