fs

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fs support facilitate for handler file and direction.

Index

Constants

View Source
const (
	DirScannerChanMax = 5000
)
View Source
const (
	VEnvPath = "path"
)

Variables

This section is empty.

Functions

func AddEnvPath added in v0.3.0

func AddEnvPath(paths ...string) string

AddEnvPath and path to env

func Append added in v0.5.0

func Append(filename, text string) error

Append append content to a file

func CheckDir added in v0.2.1

func CheckDir(dir string) string

CheckDir checkout if dir exist, when not exist will try to build it and return the path.

func CheckFileDir added in v1.4.0

func CheckFileDir(filename string) string

CheckFileDir detect whether the parent directory where the file is located exists, and use it to automatically generate the parent directory when generating files (adaptable)

func Copy

func Copy(dstFile, srcFile string) (bool, error)

Copy file by io

func CopyDir added in v0.3.1

func CopyDir(dst, src string)

CopyDir copy all file in a dir

func DelEnvPath added in v0.3.0

func DelEnvPath(paths ...string) string

DelEnvPath del the path from env path list.

func EnvPath added in v0.3.0

func EnvPath() []string

EnvPath get os env path list

func ExistPath added in v0.5.0

func ExistPath(vPath string) bool

ExistPath checkout the path of file/dir exist.

func GetMemStatsRange added in v1.1.0

func GetMemStatsRange() func() (runtime.MemStats, runtime.MemStats)

GetMemStatsRange get memory stats range callback

func InsToFilename added in v1.4.0

func InsToFilename(filename, ins string) string

InsToFilename Insert the name after the file name and before the suffix,

E.G `$s => /test/pathx/name-eg.docx` into `/test/pathx/name-eg{$s}.docx`

func InsToFilenameDetect added in v1.4.0

func InsToFilenameDetect(filename, ins string) string

InsToFilenameDetect tentatively obtaining the additional name of the inserted file

e.g.

`-custom => /test/pathx/name-eg.docx` into `/test/pathx/name-eg-custom.docx`

`custom.docx => /test/pathx/name-eg.docx` into `/test/pathx/custom.docx`

`/new/x/custom.docx => /test/pathx/name-eg.docx` into `/new/x/custom.docx`

func IsDir added in v0.3.0

func IsDir(dir string) bool

IsDir checkout string path is dir.

func Put added in v0.5.1

func Put(filename, text string) error

Put rewrite content to file

func RemoveList added in v1.4.0

func RemoveList(files []string) string

RemoveList batch remove File List

func StdDir added in v0.3.1

func StdDir(d string) string

StdDir the standard dir format

func StdPathList added in v1.5.0

func StdPathList(paths ...string) []string

StdPathList turn path list to standard path

func StdPathName added in v0.5.1

func StdPathName(vPath string) string

StdPathName the standard path format

Types

type ChildDirData added in v1.1.0

type ChildDirData struct {
	Name  string
	Size  int64
	IsDir bool
	Path  string
	Depth int // the max depth of dir. @todo need to do
}

type DirScanner added in v1.1.0

type DirScanner struct {
	AllItem      int
	AllDirItem   int
	AllFileItem  int
	AllSize      int64
	TopChildDick map[string]ChildDirData
	Runtime      time.Duration

	CddChanMax int // [Experimental]
	// contains filtered or unexported fields
}

DirScanner the tool to scan the dirs.

func NewDirScanner added in v1.1.0

func NewDirScanner(vDir string) *DirScanner

func (*DirScanner) BaseDir added in v1.1.0

func (ds *DirScanner) BaseDir() string

func (*DirScanner) ChanNumber added in v1.1.0

func (ds *DirScanner) ChanNumber() int

func (*DirScanner) Exclude added in v1.1.0

func (ds *DirScanner) Exclude(excludes ...string) *DirScanner

Exclude exclude exp for dir scan

func (*DirScanner) Include added in v1.1.0

func (ds *DirScanner) Include(includes ...string) *DirScanner

Include exclude exp for dir scan

func (*DirScanner) Scan added in v1.1.0

func (ds *DirScanner) Scan() error

Scan to star scan the dir.

func (*DirScanner) ScanParallel added in v1.1.0

func (ds *DirScanner) ScanParallel() error

ScanParallel to star scan the dir.[Experimental]

type MemUsage added in v1.1.0

type MemUsage struct {
}

MemUsage memory usage

func (*MemUsage) GetSysMemSub added in v1.1.0

func (m *MemUsage) GetSysMemSub() func() number.BitSize

GetSysMemSub get system memory range sub bytes

Jump to

Keyboard shortcuts

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