Documentation ¶
Index ¶
- func AbsPath(target string) string
- func Dirname(target string) string
- func FileExt(path string) string
- func FileGetContents(filename string) (data []byte, e error)
- func FilePutContents(filename string, content []byte, append bool) error
- func GetAppPath() string
- func GetDirFiles(dirPath string, stripExt bool) []string
- func IsDir(filePath string) bool
- func IsExist(path string) bool
- func IsFile(filePath string) bool
- func RelPath(target string) string
- func SafeFileName(fileName string) string
- func WalkRelDirs(target string, suffixes ...string) (dirs []string)
- func WalkRelFiles(target string, suffixes ...string) (files []string)
- type Client
- func (c *Client) Download(url string, filename string, auto bool) error
- func (c *Client) EnableIncrement(file string)
- func (c *Client) GetByte(url string, payload *ClientPayload) ([]byte, *http.Response, error)
- func (c *Client) GetCodec(url string, payload *ClientPayload, codec string, out interface{}) error
- func (c *Client) GetDoc(url string, payload *ClientPayload) (*goquery.Document, error)
- func (c *Client) GetURLExt(url string) string
- func (c *Client) GetURLFilename(url string) string
- func (c *Client) Read(url string, payload *ClientPayload) (*http.Response, error)
- func (c *Client) SaveIncrement()
- type ClientPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileGetContents ¶
FileGetContents Get bytes to file. if non-exist, create this file.
func FilePutContents ¶
FilePutContents Put bytes to file. if non-exist, create this file.
func IsExist ¶
IsExist checks whether a file or directory exists. It returns false when the file or directory does not exist.
func IsFile ¶
IsFile returns true if given path is a file, or returns false when it's a directory or does not exist.
func SafeFileName ¶
SafeFileName replace all illegal chars to a underline char
func WalkRelDirs ¶
WalkRelDirs 遍历目录,可指定后缀,返回相对路径
func WalkRelFiles ¶
WalkRelFiles 遍历文件,可指定后缀,返回相对路径
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client http client
func (*Client) EnableIncrement ¶
EnableIncrement 设置支持增量下载的状态存储文件
func (*Client) GetCodec ¶
func (c *Client) GetCodec(url string, payload *ClientPayload, codec string, out interface{}) error
GetCodec 从 URL 创建反序列化对象
func (*Client) GetURLFilename ¶
GetURLFilename 获取 URL 中文件名名
Click to show internal directories.
Click to hide internal directories.