fs

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 11 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) error

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 Copy

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

Copy 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) error

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 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 StdDir added in v0.3.1

func StdDir(d string) string

StdDir the standard dir format

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 FsReaderWriter

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

FsReaderWriter [Experimental] file read interface

func (*FsReaderWriter) Error

func (f *FsReaderWriter) Error() string

func (*FsReaderWriter) Read

func (f *FsReaderWriter) Read(p []byte) (n int, err error)

func (*FsReaderWriter) Write

func (f *FsReaderWriter) Write(p []byte) (n int, err error)

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