Documentation
¶
Index ¶
- func AbsPath(path string) (string, error)
- func AppendFile(path string, data []byte) error
- func AppendLine(path string, line string) error
- func Chmod(path string, mode os.FileMode) error
- func Chown(path string, uid, gid int) error
- func CleanPath(path string) string
- func Copy(src, dst string) error
- func CopyDir(src, dst string, style ...string) error
- func CountFiles(dir string) (int, error)
- func Exists(path string) bool
- func FindFiles(dir string, pattern string) ([]string, error)
- func FormatSize(size int64) string
- func GetBaseName(path string) string
- func GetBlockDeviceSize(path string) (int64, error)
- func GetDir(path string) string
- func GetDirSize(path string) (int64, error)
- func GetExtension(path string) string
- func GetFileName(path string) string
- func GetImageDimensions(path string) (width, height int, err error)
- func GetMimeType(path string) string
- func GetSize(path string) (int64, error)
- func HasEnoughSpace(path string, required uint64) (bool, error)
- func HeadFile(path string, n int) ([]string, error)
- func ImageAspectRatio(width, height int) string
- func IsArchive(path string) bool
- func IsAudio(path string) bool
- func IsBlockDevice(path string) bool
- func IsDir(path string) bool
- func IsDocument(path string) bool
- func IsEmpty(path string) (bool, error)
- func IsFile(path string) bool
- func IsImage(path string) bool
- func IsImageByMagic(path string) bool
- func IsSymlink(path string) bool
- func IsVideo(path string) bool
- func JoinPath(elem ...string) string
- func ListAll(dir string) ([]string, error)
- func ListDirs(dir string) ([]string, error)
- func ListFiles(dir string) ([]string, error)
- func MD5(path string) (string, error)
- func MkdirAll(path string, perm os.FileMode) error
- func Move(src, dst string) error
- func ParseSize(sizeStr string) (int64, error)
- func ReadChunks(path string, chunkSize int, handler func(chunk []byte) error) error
- func ReadFile(path string) ([]byte, error)
- func ReadFileString(path string) (string, error)
- func ReadLines(path string) ([]string, error)
- func ReadLinesWithCallback(path string, handler func(line string) error) error
- func Remove(path string) error
- func RemoveAll(path string) error
- func Rename(oldPath, newPath string) error
- func SHA256(path string) (string, error)
- func SameFile(path1, path2 string) (bool, error)
- func TailFile(path string, n int) ([]string, error)
- func Touch(path string) error
- func Truncate(path string, size int64) error
- func WalkFiles(dir string, fn func(path string) error) error
- func WriteFile(path string, data []byte, perm os.FileMode) error
- func WriteFileString(path string, content string, perm os.FileMode) error
- type BlockDevice
- type ChunkReader
- type DiskUsage
- type ImageInfo
- type InodeUsage
- type LineReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBlockDeviceSize ¶
GetBlockDeviceSize 获取块设备大小
func GetImageDimensions ¶
GetImageDimensions 获取图片尺寸
func HasEnoughSpace ¶
HasEnoughSpace 检查路径是否有足够空间
func ReadChunks ¶
ReadChunks 分块读取文件并处理
func ReadLinesWithCallback ¶
ReadLinesWithCallback 按行读取文件并回调处理
Types ¶
type BlockDevice ¶
BlockDevice 块设备信息
type ChunkReader ¶
type ChunkReader struct {
// contains filtered or unexported fields
}
ChunkReader 分块读取器
func NewChunkReader ¶
func NewChunkReader(path string, chunkSize int) (*ChunkReader, error)
NewChunkReader 创建分块读取器
type DiskUsage ¶
type DiskUsage struct {
Total uint64 // 总空间
Free uint64 // 可用空间
Used uint64 // 已用空间
UsedPct float64 // 使用百分比
Available uint64 // 用户可用空间
}
GetDiskUsage 获取磁盘使用情况
type InodeUsage ¶
GetInodeUsage 获取 inode 使用情况
func GetInodeUsage ¶
func GetInodeUsage(path string) (*InodeUsage, error)
GetInodeUsage 获取指定路径的 inode 使用情况
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader 行读取器
Click to show internal directories.
Click to hide internal directories.