sfile

package
v0.0.0-...-f1241d1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MulanPSL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProjectPath = "./"
)

Functions

func CopyDir

func CopyDir(source string, dest string, filterFn ...func(srcFilePath, destFilePath string) bool) (err error)

CopyDir copies the source directory to the dest directory.

func CopyFile

func CopyFile(source string, dest string) (err error)

CopyFile copies the source file to the dest file.

func DirExist

func DirExist(path string) bool

DirExist Is it an existing directory

func FileExist

func FileExist(path string) bool

FileExist Is it an existing file?

func FileSize

func FileSize(file string) (size string)

FileSize file size

func FileSizeUint

func FileSizeUint(file string) (size uint64)

FileSizeUint file size to uint64

func GetMimeType

func GetMimeType(filename string, content []byte) (ctype string)

GetMimeType get file mime type

func GzCompress

func GzCompress(currentPath, dest string) (err error)

GzCompress use gzip to compress to tar.gz

func GzDeCompress

func GzDeCompress(tarFile, dest string) error

GzDeCompress unzip tar.gz

func IsSubPath

func IsSubPath(subPath, path string) bool

IsSubPath Is the subPath under the path

func ParseJson

func ParseJson(data interface{}, filePath string) error

JSON文件转data

func PathExist

func PathExist(path string) (int, error)

PathExist PathExist 1 exists and is a directory path, 2 exists and is a file path, 0 does not exist

func ProgramPath

func ProgramPath(addSlash ...bool) (path string)

ProgramPath program directory path

func PutAppend

func PutAppend(path string, b []byte) (err error)

PutAppend open the specified file and write data at the end of the file

func PutOffset

func PutOffset(path string, b []byte, offset int64) (err error)

PutOffset open the specified file and write data from the specified location

func ReadFile

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

ReadFile ReadFile

func ReadLineFile

func ReadLineFile(path string, handle func(line int, data []byte) error) (err error)

ReadLineFile ReadLineFile

func RealPath

func RealPath(path string, addSlash ...bool) (realPath string)

RealPath get an absolute path

func RealPathMkdir

func RealPathMkdir(path string, addSlash ...bool) string

RealPathMkdir get an absolute path, create it if it doesn't exist

func Remove

func Remove(path string) error

Remove removes the named file or (empty) directory

func Rmdir

func Rmdir(path string, notIncludeSelf ...bool) (ok bool)

Rmdir support to keep the current directory

func RootPath

func RootPath() string

RootPath Project Launch Path

func SafePath

func SafePath(path string, pathRange ...string) string

SafePath get an safe absolute path

func SaveJson

func SaveJson(data interface{}, filename string) error

保存成JSON

func SizeFormat

func SizeFormat(s uint64) string

SizeFormat Format file size

func TmpPath

func TmpPath(pattern ...string) string

func WriteFile

func WriteFile(path string, b []byte, isAppend ...bool) (err error)

WriteFile WriteFile

func ZipCompress

func ZipCompress(currentPath, dest string) (err error)

ZipCompress zip

func ZipDeCompress

func ZipDeCompress(zipFile, dest string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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