zfile

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 11 Imported by: 31

Documentation

Overview

Package zfile file and path operations in daily development

Index

Constants

This section is empty.

Variables

View Source
var (
	ProjectPath = "."
)

Functions

func CopyDir added in v0.0.19

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

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 GzCompress added in v0.1.45

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

GzCompress use gzip to compress to tar.gz

func GzDeCompress added in v0.1.45

func GzDeCompress(tarFile, dest string) error

GzDeCompress unzip tar.gz

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

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

ProgramPath program directory path

func PutAppend added in v0.1.19

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

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

func PutOffset added in v0.1.19

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

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

func ReadFile added in v0.1.43

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

ReadFile ReadFile

func ReadLineFile added in v0.1.54

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

ReadLineFile ReadLineFile

func RealPath added in v0.0.19

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

RealPath get an absolute path

func RealPathMkdir added in v0.0.19

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

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

func Rmdir added in v0.0.19

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

Rmdir rmdir,support to keep the current directory

func RootPath added in v0.0.23

func RootPath() string

func SafePath added in v0.0.23

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

SafePath get an safe absolute path

func SizeFormat added in v0.1.60

func SizeFormat(s uint64) string

SizeFormat Format file size

func TmpPath added in v0.1.45

func TmpPath() string

func WriteFile added in v0.1.43

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

WriteFile WriteFile

func ZipCompress added in v0.1.45

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

ZipCompress zip

func ZipDeCompress added in v0.1.45

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