utilFile

package
v0.0.0-...-5f3621a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MulanPSL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDir

func CheckDir(p string, perm ...os.FileMode) bool

func Exists

func Exists(p string) bool

func First

func First(root string, findFn FilterFunc, recursion bool) (string, error)

func FirstN

func FirstN(root string, limit int, findFn FilterFunc) ([]string, error)

func First_old

func First_old(path string, findFn FilterFunc, recursion bool) (string, error)

func FormatSize

func FormatSize(b int64) string

func GetDirSize

func GetDirSize(p string) int64

func GetModTime

func GetModTime(path string) (int64, error)

func IsDir

func IsDir(p string) bool

func IsFile

func IsFile(p string) bool

func Md5

func Md5(file string) (fileMd5 string, err error)

func Move

func Move(src string, dst string) error

func ParseJSON

func ParseJSON(path string, v interface{}) error

func ReadLines

func ReadLines(file string) (lines []string, err error)

func ReadLinesWithFilter

func ReadLinesWithFilter(file string, handle func(line string) (matched bool, broken bool)) (lines []string, err error)

func RemoveWithGlob

func RemoveWithGlob(path string) (err error)

func SafePath

func SafePath(path string) string

func ToLinux

func ToLinux(path string) string

func Unzip

func Unzip(zipFile string, destDir string, filterFn FilterFunc) error

func Zip

func Zip(srcFile string, destZip string, filterFn FilterFunc) error

Types

type ByModTimeAsc

type ByModTimeAsc []os.FileInfo

func SortByModTimeAsc

func SortByModTimeAsc(fis []os.FileInfo) (sortedFiles ByModTimeAsc)

func (ByModTimeAsc) Len

func (fis ByModTimeAsc) Len() int

func (ByModTimeAsc) Less

func (fis ByModTimeAsc) Less(i, j int) bool

func (ByModTimeAsc) Swap

func (fis ByModTimeAsc) Swap(i, j int)

type ByModTimeDesc

type ByModTimeDesc []os.FileInfo

func SortByModTimeDesc

func SortByModTimeDesc(fis []os.FileInfo) (sortedFiles ByModTimeDesc)

func (ByModTimeDesc) Len

func (fis ByModTimeDesc) Len() int

func (ByModTimeDesc) Less

func (fis ByModTimeDesc) Less(i, j int) bool

func (ByModTimeDesc) Swap

func (fis ByModTimeDesc) Swap(i, j int)

type FilterFunc

type FilterFunc func(file fs.FileInfo, path string) bool

Jump to

Keyboard shortcuts

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