Documentation
¶
Index ¶
- Variables
- func BinaryPath() string
- func BytesToString(bytes []byte) string
- func CallerPath() string
- func Copy(src, dst string) error
- func CopyFs(srcFs fs.FS, srcpath, destpath string) error
- func CreateFile(filename string) (*os.File, error)
- func FileSum(name string, h hash.Hash) []byte
- func IsDir(name string) bool
- func IsExist(name string) bool
- func Md5(name string) []byte
- func Mkdir(dir string) error
- func OpenFile(filename string, flag int, perm os.FileMode) (*os.File, error)
- func ReadLine(file string) (next func() ([]byte, error), cleanup func() error, err error)
- func ReadLines(file string) ([][]byte, error)
- func ReadStringLines(filename string) ([]string, error)
- func ReaderSum(reader io.Reader, h hash.Hash) []byte
- func Sha1(name string) []byte
- func Sha256(name string) []byte
- func Sha512(name string) []byte
- func StringToBytes(str string) []byte
- func TarGzip(src, dest string) error
- func TempDir(dir string) (temp string, cleanup func() error, err error)
- func TempFile(dir, pattern string) (temp *os.File, cleanup func() error, err error)
- func Truncate(filename string) error
- func UnTarGzip(src, dest string) error
- func UnZip(src string, dest string) error
- func Zip(src string, dest string) error
- type Crc32
- type Crc64
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BinaryPath ¶ added in v1.1.0
func BinaryPath() string
BinaryPath returns the current binary running path
func BytesToString ¶ added in v1.1.0
BytesToString return the string representation of the bytes, if the bytes changes, string changes too
func CopyFs ¶ added in v1.1.0
CopyFs copies the specified srcpath from srcFs to destpath in os fs, only copy dir and regular files.
func CreateFile ¶
CreateFile creates a new file, create parent-directory first if parent-directory does not exist, then create the specified file.
func Mkdir ¶
Mkdir creates a directory, create parent-directory first if parent-directory does not exist.
func OpenFile ¶
OpenFile open a new file, create parent-directory first if parent-directory does not exist, then open the specified file.
func ReadLine ¶ added in v1.1.0
ReadLine returns an iterator that iterate over per line of the given file.
func ReadStringLines ¶ added in v1.1.0
ReadStringLines return a slice of strings of file contents split by line.
func StringToBytes ¶ added in v1.1.0
StringToBytes return the underlying []byte of string, returned bytes must not be modified
func TarGzip ¶
TarGzip use tar gzip to compress src path into an archive, only includes dir and regular files.
func TempDir ¶ added in v1.1.0
TempDir creates a temporary directory, and returns a cleanup function to clean up temporary dir
func TempFile ¶ added in v1.1.0
TempFile creates a temporary file, and returns a cleanup function to clean up temporary file