filepath_plus

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlterFile

func AlterFile(path string, data []byte) error

AlterFile

alter file
@param path string
@param data []byte

this method will keep file mode if file not exist, will not create file and return error

func AlterFileWithString

func AlterFileWithString(path string, content string, fileMod fs.FileMode) error

AlterFileWithString

check or file with content, if file exist, will coverage
@param path string
@param content string
@param fileMod os.FileMode(0766) os.FileMode(0666) os.FileMode(0644)

func AlterFileWithStringFast

func AlterFileWithStringFast(path string, content string) error

AlterFileWithStringFast

check or file with content, if file exist, will coverage
crate folder of file with os.FileMode(0766)
@param path string
@param content string

func AppendFileHead

func AppendFileHead(path string, content []byte) error

AppendFileHead

append file head
@param path string
@param content []byte

this method will keep file mode if file not exist, will not create file and return error

func AppendFileTail

func AppendFileTail(path string, content []byte) error

AppendFileTail

append file tail
@param path string
@param content []byte

this method will keep file mode if file not exist, will not create file and return error

func CheckOrCreateFileWithString

func CheckOrCreateFileWithString(path string, content string, fileMod fs.FileMode) error

CheckOrCreateFileWithString

check or create file with content, if file exist, will not coverage
@param path string
@param content string
@param fileMod os.FileMode(0766) os.FileMode(0666) os.FileMode(0644)

func CheckOrCreateFileWithStringFast

func CheckOrCreateFileWithStringFast(path string, context string) error

CheckOrCreateFileWithStringFast

check or create file with content, if file exist, will not coverage
crate folder of file with os.FileMode(0766)
@param path string
@param content string

func Mkdir

func Mkdir(path string) error

Mkdir

will use FileMode 0766

func PathExists

func PathExists(path string) (bool, error)

PathExists

path exists

func PathExistsFast

func PathExistsFast(path string) bool

PathExistsFast

path exists fast

func PathIsDir

func PathIsDir(path string) bool

PathIsDir

path is dir

func ReadFileAsByte

func ReadFileAsByte(path string) ([]byte, error)

ReadFileAsByte

read file as byte array

func RmDir

func RmDir(path string, force bool) error

RmDir

remove dir by path

func WriteFileByByte

func WriteFileByByte(path string, data []byte, fileMod fs.FileMode, coverage bool) error

WriteFileByByte

write bytes to file
path most use Abs Path
data []byte
fileMod os.FileMode(0766) os.FileMode(0666) os.FileMode(0644)
coverage true will coverage old

Types

This section is empty.

Jump to

Keyboard shortcuts

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