file

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package imgext return array of all Image Extensions

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

This section is empty.

Functions

func ByteCountIEC

func ByteCountIEC(b int) string

func CheckNotExist

func CheckNotExist(src string) bool

CheckNotExist check if the file exists

func CheckPermission

func CheckPermission(src string) bool

CheckPermission check if the file has permission

func FileCreate

func FileCreate(content bytes.Buffer, name string)

func FileExist

func FileExist(path string) bool

func FileMonitoringById

func FileMonitoringById(ctx context.Context, filePth string, id string, group string, hookfn func(context.Context, string, string, []byte))

func FormatFileSize

func FormatFileSize(fileSize int64) (size string)

字节的单位转换 保留两位小数

func GetCurrentPath

func GetCurrentPath() string

获取当前路径,比如:E:/abc/data/test

func GetExt

func GetExt(fileName string) string

GetExt get the file ext

func GetFileSize

func GetFileSize(filename string) int64

获取文件大小

func GetFileType

func GetFileType(ft string) string

文件类型选择

func GetImgExt

func GetImgExt() []string

func GetImgType

func GetImgType(p string) (string, error)

GetImgType 获取Img文件类型

func GetParentDirectory

func GetParentDirectory(directory string) string

func GetSize

func GetSize(f multipart.File) (int, error)

GetSize get the file size

func GetType

func GetType(p string) (string, error)

GetType 获取文件类型

func IsDirectory

func IsDirectory(filename string) bool

func IsFile

func IsFile(filename string) bool

func IsHiddenFile

func IsHiddenFile(name string) bool

func IsNotExistMkDir

func IsNotExistMkDir(src string) error

IsNotExistMkDir create a directory if it does not exist

func MkDir

func MkDir(src string) error

MkDir create a directory

func MkFileIfNotExist

func MkFileIfNotExist(path string)

func MkdirIfNotExist

func MkdirIfNotExist(path string)

func MustOpen

func MustOpen(fileName, filePath string) (*os.File, error)

MustOpen maximize trying to open the file

func NormalizeEOL

func NormalizeEOL(input []byte) []byte

NormalizeEOL will convert Windows (CRLF) and Mac (CR) EOLs to UNIX (LF)

func Open

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Open a file according to a specific mode

func ParseFileContentType

func ParseFileContentType(fileName string) string

func PathCreate

func PathCreate(dir string) error

func PathExist

func PathExist(addr string) bool

PathExist 判断目录是否存在

func Substr

func Substr(s string, pos, length int) string

func UploadFileTo

func UploadFileTo(fh *multipart.FileHeader, destDirectory string) (int64, error)

Types

type ReplaceHelper

type ReplaceHelper struct {
	Root    string //路径
	OldText string //需要替换的文本
	NewText string //新的文本
}

func (*ReplaceHelper) DoWrok

func (h *ReplaceHelper) DoWrok() error

Jump to

Keyboard shortcuts

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