fs

package
v2.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package fs support facilitate for handler file and direction.

Index

Constants

View Source
const (
	VEnvPath = "path"
)

Variables

This section is empty.

Functions

func AddEnvPath

func AddEnvPath(paths ...string) error

AddEnvPath and path to env

func AppName

func AppName() string

AppName Get the name of the current application without any suffix

func Append

func Append(filename, text string) error

Append append content to a file

func CheckDir

func CheckDir(dir string) string

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

func CheckFileDir

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

func CopyDir(dst, src string)

CopyDir copy all file in a dir

func DelEnvPath

func DelEnvPath(paths ...string) error

DelEnvPath del the path from env path list.

func EnvPath

func EnvPath() []string

EnvPath get os env path list

func ExistPath

func ExistPath(vPath string) bool

ExistPath checkout the path of file/dir exist.

func GetMemStatsRange

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

GetMemStatsRange get memory stats range callback

func InsToFilename

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

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

func IsDir(dir string) bool

IsDir checkout string path is dir.

func Put

func Put(filename, text string) error

Put rewrite content to file

func RemoveList

func RemoveList(files []string) string

RemoveList batch remove File List

func RootFile

func RootFile() string

RootFile Get the full path of the current application

func RootPath

func RootPath(joins ...string) string

RootPath Get the directory where the application is located

func RunDir

func RunDir(joins ...string) string

RunDir Prioritize obtaining the current working directory, and try to obtain the directory where the application is located after failure, ensuring that the directory exists as much as possible.

func Split

func Split(vPath string) (baseDir, file, name string)

Split Decompose the path into base directory, file name, and file name without suffix

func StdDir

func StdDir(d string) string

StdDir the standard dir format

func StdPathName

func StdPathName(vPath string) string

StdPathName the standard path format

Types

type MemUsage

type MemUsage struct {
}

MemUsage memory usage

func (*MemUsage) GetSysMemSub

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