Documentation ¶
Index ¶
- Constants
- Variables
- func AesDecrypt(crypted, key []byte) ([]byte, *data.CodeError)
- func AesEncrypt(origData, key []byte) ([]byte, *data.CodeError)
- func BytesToReadable(size int64) (readable string)
- func CreateDirIfNotExist(path string) *data.CodeError
- func CreateFileDirIfNotExist(path string) *data.CodeError
- func CreateFileIfNotExist(path string) *data.CodeError
- func CreateRandString(num int) (rcode string)
- func Decode(encodedURI string) (uri string, err *data.CodeError)
- func DirCache(cacheRootPath string, cacheResultFile string) (int64, *data.CodeError)
- func Encode(uri string) string
- func Endpoint(useHttps bool, host string) string
- func EtagV1(reader io.Reader) (string, *data.CodeError)
- func EtagV2(reader io.Reader, parts []int64) (string, *data.CodeError)
- func ExistDir(path string) (bool, *data.CodeError)
- func ExistFile(path string) (bool, *data.CodeError)
- func FileLineCounts(filePath string) (count int64, err *data.CodeError)
- func FileSize(filePath string) (fileSize int64, err *data.CodeError)
- func FormatFileSize(size int64) (result string)
- func Gbk2Utf8(text string) (string, *data.CodeError)
- func GenEncoding() []byte
- func GetAkBucketFromUploadToken(token string) (ak, bucket string, err *data.CodeError)
- func GetEtag(filename string) (etag string, err *data.CodeError)
- func GetFileLineCount(filePath string) (totalCount int64)
- func GetHomePath() (string, *data.CodeError)
- func GetLineCount(reader io.Reader) (totalCount int64)
- func GetNotEmptyStringIfExist(values ...string) string
- func GetNotZeroInt16IfExist(values ...int16) int16
- func GetNotZeroInt64IfExist(values ...int64) int64
- func GetNotZeroInt8IfExist(values ...int8) int8
- func GetNotZeroIntIfExist(values ...int) int
- func GetNotZeroUInt16IfExist(values ...uint16) uint16
- func GetNotZeroUInt64IfExist(values ...uint64) uint64
- func GetNotZeroUInt8IfExist(values ...uint8) uint8
- func GetNotZeroUIntIfExist(values ...uint) uint
- func GetTrueBoolValueIfExist(values ...bool) bool
- func IsCmdExist(cmd string) bool
- func IsGBKEncoding(encoding string) bool
- func IsHostUnavailableError(err error) bool
- func IsIPString(host string) bool
- func IsIPUrlString(host string) bool
- func IsNetworkSource(filePath string) bool
- func IsSignByEtagV2(etag string) bool
- func IsWindowsOS() bool
- func KeyFromUrl(uri string) (key string, err *data.CodeError)
- func LocalFileSize(filePath string) (int64, *data.CodeError)
- func Md5Hex(from string) string
- func NetworkFileLength(srcResUrl string) (fileSize int64, err *data.CodeError)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func RemoveUrlScheme(url string) string
- func SimpleUnescape(s *string) string
- func SplitString(line, sep string) []string
- func UnMarshalFromFile(filePath string, v interface{}) *data.CodeError
- func Unzip(zipFilePath string, unzipPath string) (err *data.CodeError)
- func UserAgent() string
Constants ¶
View Source
const ( KB = 1024 MB = 1024 * KB GB = 1024 * MB TB = 1024 * GB )
Variables ¶
View Source
var ErrPartSizeMismatch = data.NewEmptyError().AppendDesc("part size mismatch with data from reader")
Functions ¶
func BytesToReadable ¶
BytesToReadable 将字节转化为人工可读的字符串 b - 表示文件大小,单位字节, readable - 可读字符串 比如1304 ==》1304/1024 ==> 1.27KB
func CreateDirIfNotExist ¶
func CreateFileDirIfNotExist ¶
func CreateFileIfNotExist ¶
func DirCache ¶
DirCache generate the file list for the specified directory @param cacheRootPath - dir to generate cache file @param cacheResultFile - cache result file path @return (fileCount, retErr) - total file count and any error meets
func Encode ¶
Encode URL:
http://host/url https://host/url
Path:
AbsolutePath (Must start with '/') Pid:RelPath (Pid.len = 16) Id: (Id.len = 16) :LinkId:RelPath :LinkId
func FormatFileSize ¶
FormatFileSize 转化文件大小到人工可读的字符串,以相应的单位显示
func GenEncoding ¶
func GenEncoding() []byte
func GetFileLineCount ¶
GetFileLineCount 获取文件行数
func GetHomePath ¶
func GetNotZeroInt16IfExist ¶
func GetNotZeroInt64IfExist ¶
func GetNotZeroInt8IfExist ¶
func GetNotZeroIntIfExist ¶
func GetNotZeroUInt16IfExist ¶
func GetNotZeroUInt64IfExist ¶
func GetNotZeroUInt8IfExist ¶
func GetNotZeroUIntIfExist ¶
func GetTrueBoolValueIfExist ¶
func IsCmdExist ¶
func IsGBKEncoding ¶
func IsHostUnavailableError ¶
func IsIPString ¶
func IsIPUrlString ¶
func IsNetworkSource ¶
func IsSignByEtagV2 ¶
func IsWindowsOS ¶
func IsWindowsOS() bool
func KeyFromUrl ¶
KeyFromUrl 从URL中获取文件名字
func NetworkFileLength ¶
func PKCS5Padding ¶
加密解密需要数据一定的格式, 如果愿数据不符合要求,需要加一些padding
func PKCS5UnPadding ¶
加密解密需要数据一定的格式, 如果愿数据不符合要求,需要加一些padding
func RemoveUrlScheme ¶
func SimpleUnescape ¶
func SplitString ¶
func UnMarshalFromFile ¶
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.