Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) Delete(remoteFile string) error
- func (c *Client) Get(concurrency int, remoteFile string, localFile string, ...) error
- func (c *Client) GetDeleteFileURL(remoteFile string) string
- func (c *Client) GetDownloadFileURL(remoteFile string) string
- func (c *Client) GetListURL() string
- func (c *Client) GetPingURL() string
- func (c *Client) GetServerURL() *url.URL
- func (c *Client) GetUploadFileURL(remoteFile string, taskID ...string) string
- func (c *Client) List(cb func(info *FileInfo)) error
- func (c *Client) Ping() (time.Duration, error)
- func (c *Client) Put(concurrency int, overwrite bool, localFile string, remoteFile string, ...) error
- func (c *Client) SetAuth(s string, direct ...bool)
- type ClientOption
- type Fetcher
- func (fetcher *Fetcher) Do(req *http.Request) (*http.Response, error)
- func (fetcher *Fetcher) Download(url string, option *FetcherDownloadOption) error
- func (fetcher *Fetcher) DownloadWithManual(url string, supported bool, length int64, option *FetcherDownloadOption) (fatalErr error)
- func (fetcher *Fetcher) Inspect(url string) (supported bool, length int64, err error)
- type FetcherDownloadOption
- type FetcherOption
- type FileInfo
- type FileWriter
- func (fh *FileWriter) Close() error
- func (fw *FileWriter) Handler(index int, start, end, length int64, r io.Reader, ctx context.Context) error
- func (fh *FileWriter) OnWrite(cb func(n int, index int, start, end, length int64))
- func (fh *FileWriter) Truncate(size int64) error
- func (fh *FileWriter) WrittenN() int64
- type Service
- type ServiceOption
- type UploadInfo
Constants ¶
View Source
const ( WhenInspect = iota + 1 WhenDownload )
View Source
const (
AuthHeader = "auth"
)
Variables ¶
View Source
var Version = "0.0.0"
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opt ClientOption) (*Client, error)
Don't set FetcherOption.ResponsePreInspector, it will be overwritten
func (*Client) Get ¶
func (c *Client) Get(concurrency int, remoteFile string, localFile string, hook func(beforeDownload bool, supported bool, length int64, n int)) error
Get remote file to local if localFile is empty, then use remoteFile
func (*Client) GetDeleteFileURL ¶
func (*Client) GetDownloadFileURL ¶
func (*Client) GetListURL ¶
func (*Client) GetPingURL ¶
func (*Client) GetUploadFileURL ¶
type ClientOption ¶
type ClientOption struct { Auth string // if path not ends with /, then auto append it ServerURL string FetcherOption }
type Fetcher ¶
Concurrent HTTP downloader
func NewFetcher ¶
func NewFetcher(option FetcherOption) (*Fetcher, error)
func (*Fetcher) Download ¶
func (fetcher *Fetcher) Download(url string, option *FetcherDownloadOption) error
Download and auto inspect
func (*Fetcher) DownloadWithManual ¶
func (fetcher *Fetcher) DownloadWithManual(url string, supported bool, length int64, option *FetcherDownloadOption) (fatalErr error)
Download with specified inspect result
type FetcherDownloadOption ¶
type FetcherOption ¶
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
func NewFileWriter ¶
func NewFileWriter(name string) (*FileWriter, error)
func (*FileWriter) Close ¶
func (fh *FileWriter) Close() error
func (*FileWriter) OnWrite ¶
func (fh *FileWriter) OnWrite(cb func(n int, index int, start, end, length int64))
func (*FileWriter) Truncate ¶
func (fh *FileWriter) Truncate(size int64) error
func (*FileWriter) WrittenN ¶
func (fh *FileWriter) WrittenN() int64
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(option ServiceOption) *Service
type ServiceOption ¶
type UploadInfo ¶
Click to show internal directories.
Click to hide internal directories.