Documentation
¶
Index ¶
- Constants
- func Bytes(s uint64) string
- func CalculateSHA256Byte(data []byte) string
- func CalculateSHA256Checksum(filePath string) (string, error)
- func CheckFullPath(path string) bool
- func CheckLinuxPath(path string) bool
- func CheckWindowsPath(path string) bool
- func ChmodR(path string, filePerm, dirPerm os.FileMode) error
- func CollectFilePaths(rootPath string) ([]string, error)
- func CompressFilesZip(filePaths []string) ([]byte, error)
- func CopyDirectoryExcept(sourceDir, targetDir string, excludeFiles []string) error
- func CopyFile(src string, dst string) error
- func DecodeBase64OrRaw(data string) ([]byte, error)
- func DecompressBase64ToFiles(base64Data, outputDir string) error
- func DecompressZipSubdirToRoot(zipData []byte, subdir, outputDir string) error
- func DeflateBuf(data []byte) []byte
- func DetectContentType(data []byte) string
- func EncodeBase64OrRaw(data []byte) string
- func Exist(filePath string) bool
- func ExtractTarGz(gzipPath string, dest string) error
- func ExtractZip(zipData []byte, targetDir string) error
- func ExtractZipSubdir(zipData []byte, subdir, targetDir string) error
- func ExtractZipWithFilter(zipData []byte, targetDir string, filter func(string) bool) error
- func ForceRemoveAll(rootPath string) error
- func FormatWindowPath(path string) string
- func GetExtensionByBytes(data []byte) (string, error)
- func GetExtensionByPath(filepath string) (string, error)
- func IBytes(s uint64) string
- func MoveDirectory(sourceDir, destDir string) error
- func MoveFile(sourcePath, destPath string) error
- func ParseBytes(s string) (uint64, error)
- func ReadFileFromTarGz(tarGzFile string, tarPath string) ([]byte, error)
- func RemoveFile(filePath string) error
- func ResolvePath(in string) string
- func UnzipOneWithBytes(content []byte) ([]byte, error)
- func WithTempDir(prefix string, fn func(tempDir string) error) error
Constants ¶
const ( Byte = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
IEC Sizes. kibis of bits
const ( IByte = 1 KByte = IByte * 1000 MByte = KByte * 1000 GByte = MByte * 1000 TByte = GByte * 1000 PByte = TByte * 1000 EByte = PByte * 1000 )
SI Sizes.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes produces a human readable representation of an SI size.
See also: ParseBytes.
Bytes(82854982) -> 83 MB
func CalculateSHA256Byte ¶ added in v0.1.2
func CalculateSHA256Checksum ¶
func CheckFullPath ¶ added in v0.1.0
func CheckLinuxPath ¶ added in v0.1.0
func CheckWindowsPath ¶ added in v0.1.0
func CollectFilePaths ¶ added in v0.1.2
CollectFilePaths collects all file paths from the given directory recursively
func CompressFilesZip ¶ added in v0.1.2
CompressFilesZip 将多个文件压缩成zip
func CopyDirectoryExcept ¶ added in v0.1.2
CopyDirectoryExcept copies all files and directories from sourceDir to targetDir except the excluded files.
func DecodeBase64OrRaw ¶ added in v0.1.2
DecodeBase64OrRaw attempts to decode base64 string, falls back to raw bytes if decoding fails
func DecompressBase64ToFiles ¶ added in v0.1.2
DecompressBase64ToFiles 将base64字符串解压并提取文件到指定目录
func DecompressZipSubdirToRoot ¶ added in v0.1.2
func DeflateBuf ¶
DeflateBuf - Deflate a buffer using BestCompression (9)
func DetectContentType ¶ added in v0.1.2
DetectContentType
func EncodeBase64OrRaw ¶ added in v0.1.2
EncodeBase64OrRaw encodes the given data to base64 string, falls back to raw bytes if encoding fails
func ExtractTarGz ¶
ExtractTarGz extracts a .tar.gz file to the specified destination directory
func ExtractZip ¶ added in v0.1.2
ExtractZip 解压zip文件到目标目录
func ExtractZipSubdir ¶ added in v0.1.2
ExtractZipSubdir 解压指定子目录到目标路径
func ExtractZipWithFilter ¶ added in v0.1.2
ExtractZipWithFilter 使用过滤器解压文件
func ForceRemoveAll ¶
func FormatWindowPath ¶
func GetExtensionByBytes ¶ added in v0.1.1
func GetExtensionByPath ¶ added in v0.1.1
func IBytes ¶
IBytes produces a human readable representation of an IEC size.
See also: ParseBytes.
IBytes(82854982) -> 79 MiB
func MoveDirectory ¶
func ParseBytes ¶
ParseBytes parses a string representation of bytes into the number of bytes it represents.
See Also: Bytes, IBytes.
ParseBytes("42 MB") -> 42000000, nil ParseBytes("42 mib") -> 44040192, nil
func ReadFileFromTarGz ¶
ReadFileFromTarGz - Read a file from a tar.gz file in-memory
func ResolvePath ¶
ResolvePath - Resolve a path from an assumed root path
func UnzipOneWithBytes ¶ added in v0.1.0
UnzipOneWithBytes 从zip字节数据中解压单个文件并返回其内容
Types ¶
This section is empty.