fileutil

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: MIT Imports: 10 Imported by: 16

Documentation

Overview

Package fileutil implements some basic functions for file operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearFile added in v1.0.6

func ClearFile(path string) error

ClearFile write empty string to path file

func CopyFile

func CopyFile(srcFilePath string, dstFilePath string) error

CopyFile copy src file to dest file

func CreateFile

func CreateFile(path string) bool

CreateFile create a file in path

func FileMode added in v1.1.8

func FileMode(path string) (fs.FileMode, error)

FileMode return file's mode and permission

func IsDir

func IsDir(path string) bool

IsDir checks if the path is directory or not

func IsExist

func IsExist(path string) bool

IsExist checks if a file or directory exists

func IsLink(path string) bool

IsLink checks if a file is symbol link or not

func ListFileNames

func ListFileNames(path string) ([]string, error)

ListFileNames return all file names in the path

func MiMeType added in v1.1.8

func MiMeType(file interface{}) string

MiMeType return file mime type param `file` should be string(file path) or *os.File

func ReadFileByLine added in v1.0.6

func ReadFileByLine(path string) ([]string, error)

ReadFileByLine read file line by line

func ReadFileToString added in v1.0.6

func ReadFileToString(path string) (string, error)

ReadFileToString return string of file content

func RemoveFile

func RemoveFile(path string) error

RemoveFile remove the path file

func UnZip added in v1.1.8

func UnZip(zipFile string, destPath string) error

UnZip unzip the file and save it to destPath

func Zip added in v1.1.8

func Zip(fpath string, destPath string) error

Zip create zip file, fpath could be a single file or a directory

Types

This section is empty.

Jump to

Keyboard shortcuts

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