yeeFile

package
v0.0.0-...-89bd919 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

file 文件处理相关函数

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBytes

func AppendBytes(filename string, data []byte) error

AppendBytes 向指定的文件追加[]byte内容.

func AppendString

func AppendString(filename string, data string) error

AppendString 向指定的文件追加string内容.

func Copy

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

Copy 将文件从原地址拷贝到目的地.

func DirSize

func DirSize(path string) int64

DirSize 返回文件夹的大小

func FileExists

func FileExists(filename string) bool

FileExists 文件或者文件夹是否存在.

func FileTimeModified

func FileTimeModified(filename string) time.Time

FileTimeModified 返回文件的最后修改时间 如果有错误则返回空time.Time.

func Find

func Find(searchDirs []string, filenames ...string) (filePath string, found bool)

Find 在给定的文件夹中查找某文件.

func GetBytes

func GetBytes(filenameOrURL string, timeout ...time.Duration) ([]byte, error)

GetBytes 通过给定的文件名称或者url地址以及超时时间获取文件的[]byte数据.

func GetExt

func GetExt(filename string) string

GetExt 获取文件的后缀.

func GetPrefix

func GetPrefix(filename string) string

GetPrefix 获取文件的前缀.

func GetString

func GetString(filenameOrURL string, timeout ...time.Duration) (string, error)

GetString 通过给定的文件名称或者url地址以及超时时间获取文件的string数据.

func IsDir

func IsDir(dirname string) bool

IsDir 判断是否是文件夹.

func Mkdir

func Mkdir(path string) error

Mkdir 创建文件夹

func MkdirForFile

func MkdirForFile(path string) (err error)

MkdirForFile 为某个文件创建目录

func SetBytes

func SetBytes(filename string, data []byte) error

SetBytes 向指定的文件设置[]byte内容.

func SetString

func SetString(filename string, data string) error

SetString 向指定的文件设置string内容.

Types

This section is empty.

Jump to

Keyboard shortcuts

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