qio

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirectory

func CreateDirectory(path string) (string, error)

CreateDirectory

@Description: 创建文件夹
@param path 文件路径或文件夹路径
@return string 文件夹路径
@return error 是否成功

func CreateFile added in v0.0.9

func CreateFile(path string) error

CreateFile

@Description: 创建空文件
@param path
@return error

func DeleteFile

func DeleteFile(filename string) error

DeleteFile

@Description: 删除文件
@param filename
@return error

func GetCurrentDirectory

func GetCurrentDirectory() (string, error)

GetCurrentDirectory

@Description: 获取程序的当前工作目录
@return string
@return error

func GetDirectory

func GetDirectory(path string) string

GetDirectory

@Description: 获取路径下面的目录
@param path 文件路径
@return string 目录

func GetFileExt

func GetFileExt(path string) string

GetFileExt

@Description: 获取文件的后缀名
@param path
@return string

func GetFileName

func GetFileName(path string) string

GetFileName

@Description: 获取文件名
@param path
@return string

func GetFileNameWithoutExt

func GetFileNameWithoutExt(path string) string

GetFileNameWithoutExt

@Description: 获取没有后缀名的文件名
@param path
@return string

func GetFiles

func GetFiles(path string) ([]string, error)

GetFiles

@Description: 获取指定目录下面的所有文件
@param path
@return []string
@return error

func GetFilesByPattern added in v0.0.9

func GetFilesByPattern(path string, searchPattern string) ([]string, error)

GetFilesByPattern

@Description: 获取指定目录下面的所有文件
@param path
@param searchPattern
@return []string
@return error

func GetFolders added in v0.0.15

func GetFolders(path string) ([]string, error)

GetFolders

@Description: 获取指定目录下面的所有文件夹
@param path
@return []string
@return error

func GetFullPath

func GetFullPath(path string) string

GetFullPath

@Description: 获取完整路径
@param path 相对路径
@return string

func IsDirectory

func IsDirectory(path string) bool

IsDirectory

@Description: 判断所给路径是否为文件夹
@param path
@return bool

func IsFile

func IsFile(path string) bool

IsFile

@Description: 判断所给路径是否为文件
@param path
@return bool

func PathExists

func PathExists(path string) bool

PathExists

@Description: 判断文件或文件夹是否存在
@param path 路径
@return bool

func ReadAllBytes

func ReadAllBytes(filename string) ([]byte, error)

ReadAllBytes

@Description: 读取文件内容到数组
@param filename
@return []byte
@return error

func ReadAllString

func ReadAllString(filename string) (string, error)

ReadAllString

@Description: 读取文件内容到字符串
@param filename
@return string
@return error

func WriteAllBytes

func WriteAllBytes(filename string, bytes []byte, isAppend bool) error

WriteAllBytes

@Description: 写入字节数组,如果文件不存在则创建
@param filename
@param bytes
@param isAppend
@return error

func WriteString

func WriteString(filename string, str string, isAppend bool) error

WriteString

@Description: 写入字符串,如果文件不存在则创建
@param filename
@param str
@param isAppend
@return error

Types

This section is empty.

Jump to

Keyboard shortcuts

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