gofiles

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2020 License: MIT Imports: 10 Imported by: 0

README

gofiles

Useful functions to work with files in Go.

Documentation

Index

Constants

View Source
const GZExtension = ".gz"

GZExtension - gz extension

Variables

This section is empty.

Functions

func DeleteFile

func DeleteFile(filePath string) error

DeleteFile - deletes a file

func GetFileInfo

func GetFileInfo(filePath string) (os.FileInfo, error)

GetFileInfo - returns the file info

func GzipDecompressFile

func GzipDecompressFile(filePath, outputPath string) error

GzipDecompressFile - ungzips a file

func GzipFile

func GzipFile(filePath, outputPath string) error

GzipFile - gzips a file

func ReadFileBytes

func ReadFileBytes(filePath string) ([]byte, error)

ReadFileBytes - read all specified file bytes

Types

type File

type File struct {
	Name             string
	Path             string
	Size             int64
	LastModification time.Time
	Ignored          bool
}

File - has some basic information about the file

type ScanResult

type ScanResult struct {
	Files   []*File
	Ignored []*File
	Errors  []error
}

ScanResult - has all files and errors found when traversing the files in root directory

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner - Scans a directory and find files using regular expression

func NewScanner

func NewScanner(fileRegexp string, minFileSize int64) *Scanner

NewScanner - builds a new Scanner

func (*Scanner) Scan

func (s *Scanner) Scan(directoryRoot string) (*ScanResult, error)

Scan - searches recursively for files with the same regexp pattern selected

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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