Documentation ¶
Index ¶
- Constants
- type File
- func (*File) AbsPath(filePath string) string
- func (*File) AppendFile(filePath string, data string) error
- func (*File) Basename(filePath string) string
- func (*File) Chmod(filePath string, fileMode os.FileMode) (res bool)
- func (toolFile *File) CopyDir(source string, dest string, coverType ...int) (int64, error)
- func (toolFile *File) CopyFile(source string, dest string, coverType ...int) (int64, error)
- func (toolFile *File) CopyLink(source string, dest string) error
- func (*File) CountLines(filePath string, cacheLength ...int) (int, error)
- func (toolFile *File) DelDir(dir string, delRoot ...bool) error
- func (*File) DirSize(filePath string) int64
- func (toolFile *File) Dirname(filePath string) string
- func (toolFile *File) Ext(filePath string) string
- func (toolFile *File) FastCopy(source string, dest string) (int64, error)
- func (*File) FormatDir(filePath string) string
- func (toolFile *File) FormatPath(filePath string) string
- func (*File) Glob(pattern string) ([]string, error)
- func (toolFile *File) IsBinary(filePath string) bool
- func (*File) IsDir(filePath string) bool
- func (*File) IsExecutable(filePath string) bool
- func (*File) IsExist(filePath string) bool
- func (toolFile *File) IsFile(filePath string, fileType ...ParamFileType) (res bool)
- func (toolFile *File) IsImg(filePath string) bool
- func (*File) IsLink(filePath string) bool
- func (*File) IsReadable(filePath string) bool
- func (*File) IsWritable(filePath string) bool
- func (*File) IsZip(filePath string) bool
- func (*File) Md5(filePath string, length ...int) (string, error)
- func (*File) Mime(filePath string, fast bool) string
- func (*File) Mkdir(filePath string, mode os.FileMode) error
- func (*File) ModTime(filePath string) time.Time
- func (*File) Mode(filePath string) (os.FileMode, error)
- func (*File) PathInfo(filePath string, options int) map[string]string
- func (*File) ProjectPath() string
- func (*File) ReadFile(filePath string) ([]byte, error)
- func (*File) ReadFirstLine(filePath string) string
- func (*File) ReadInArray(filePath string) ([]string, error)
- func (*File) ReadLastLine(filePath string) string
- func (*File) RealPath(filePath string) string
- func (*File) Remove(filePath string) error
- func (*File) Rename(oldName, newName string) error
- func (*File) SafeFileName(str string) string
- func (*File) ShaX(filePath string, x uint16) (string, error)
- func (*File) Size(filePath string) int64
- func (toolFile *File) TarGz(src string, dstTar string, ignorePatterns ...string) (bool, error)
- func (toolFile *File) ToBase64(filePath string) (string, string, error)
- func (toolFile *File) Touch(filePath string, size int64) bool
- func (toolFile *File) Tree(filePath string, fileType int, recursive bool, filters ...FileFilter) []string
- func (toolFile *File) UnTarGz(srcTar, dstDir string) (bool, error)
- func (toolFile *File) UnZip(srcZip, dstDir string) (bool, error)
- func (*File) WriteFile(filePath string, data string, perm ...os.FileMode) error
- func (toolFile *File) Zip(dst string, fpaths ...string) (bool, error)
- type FileFilter
- type ParamFileType
Constants ¶
View Source
const ( // FILE_COVER_ALLOW 文件覆盖,允许 CoverAllow = 1 // FILE_COVER_IGNORE 文件覆盖,忽略 CoverIgnore = 0 // FILE_COVER_DENY 文件覆盖,禁止 CoverDeny = -1 // FILE_TREE_ALL 文件树,查找所有(包括目录和文件) TreeAll = 3 // FILE_TREE_DIR 文件树,仅查找目录 TreeDir = 2 // FILE_TREE_FILE 文件树,仅查找文件 TreeFile = 1 )
View Source
const ( // FILE_TYPE_ANY 文件类型-任意 FILE_TYPE_ANY = 0 // FILE_TYPE_LINK 文件类型-链接文件 FILE_TYPE_LINK = 1 // FILE_TYPE_REGULAR 文件类型-常规文件(不包括链接) FILE_TYPE_REGULAR = 2 // FILE_TYPE_COMMON 文件类型-普通文件(包括常规和链接) FILE_TYPE_COMMON = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File byte
func (*File) AppendFile ¶
AppendFile 插入文件内容.
func (*File) CopyDir ¶
CopyDir 拷贝源目录到目标目录,cover为枚举(FILE_COVER_ALLOW、FILE_COVER_IGNORE、FILE_COVER_DENY).
func (*File) CopyFile ¶
CopyFile 拷贝源文件到目标文件,cover为枚举(FILE_COVER_ALLOW、FILE_COVER_IGNORE、FILE_COVER_DENY).
func (*File) CountLines ¶
CountLines 统计文件行数.buffLength为缓冲长度,kb.
func (*File) IsFile ¶
func (toolFile *File) IsFile(filePath string, fileType ...ParamFileType) (res bool)
IsFile 判断文件是否为某类型的文件,且存在
func (*File) PathInfo ¶
PathInfo 获取文件路径的信息,options的值为-1: all; 1: dirname; 2: basename; 4: extension; 8: filename.
func (*File) ReadFirstLine ¶
ReadFirstLine 读取文件首行.
func (*File) ReadInArray ¶
ReadInArray 把整个文件读入一个数组中,每行作为一个元素.
func (*File) SafeFileName ¶
SafeFileName 将文件名转换为安全可用的字符串.
type FileFilter ¶
type ParamFileType ¶
type ParamFileType uint8
Source Files ¶
- AbsPath.go
- AppendFile.go
- Basename.go
- Chmod.go
- CopyDir.go
- CopyFile.go
- CopyLink.go
- CountLines.go
- DelDir.go
- DirSize.go
- Dirname.go
- Ext.go
- FastCopy.go
- FormatDir.go
- FormatPath.go
- Glob.go
- Global.go
- IsBinary.go
- IsDir.go
- IsExecutable.go
- IsExist.go
- IsFile.go
- IsImg.go
- IsLink.go
- IsReadable.go
- IsWritable.go
- IsZip.go
- Md5.go
- Mime.go
- Mkdir.go
- ModTime.go
- Mode.go
- PathInfo.go
- ProjectPath.go
- ReadFile.go
- ReadFirstLine.go
- ReadInArray.go
- ReadLastLine.go
- RealPath.go
- Remove.go
- Rename.go
- SafeFileName.go
- ShaX.go
- Size.go
- TarGz.go
- ToBase64.go
- Touch.go
- Tree.go
- UnTarGz.go
- UnZip.go
- WriteFile.go
- Zip.go
Click to show internal directories.
Click to hide internal directories.