Versions in this module Expand all Collapse all v0 v0.2.0 Oct 27, 2022 v0.1.0 Oct 26, 2022 Changes in this version + const CONTROLFILEHEAD + const CONTROLFILESIZE + const DOWNLOADBLOCKSIZE + var HttpClient = &http.Client + func FileExist(path string) bool + func FilterFileNameFormWindows(name string) string + func FormatFileSize(fileSize int64) string + func GetFileName(uri, contentDisposition, contentType string, headinfo []byte) string + func GetStringLength(str string) int + func SetHttpMaxIdleConnsPerHost(d int) + func SetHttpProxy(d func(*http.Request) (*url.URL, error)) + func SetHttpResponseHeaderTimeout(d time.Duration) + func SetHttpTLSHandshakeTimeout(d time.Duration) + func SetHttpTimeout(d time.Duration) + type ControlFile struct + func NewControlfile(path string, size int64, perm fs.FileMode) (*ControlFile, error) + func (cf *ControlFile) AddCompleted(key int, completed int64) + func (cf *ControlFile) AddDownloadPiece(completed, start, end int64) int + func (cf *ControlFile) Close() + func (cf *ControlFile) Encoding() *bytes.Buffer + func (cf *ControlFile) GetBreakpointResume() bool + func (cf *ControlFile) GetCompletedLength() int64 + func (cf *ControlFile) GetDownloadPiece() []*DownloadPiece + func (cf *ControlFile) ParseControlfile(data []byte) *ControlFile + func (cf *ControlFile) Remove() error + func (cf *ControlFile) Save() + func (cf *ControlFile) SetSaveEvent(d func()) + type DownloadPiece struct + Completed int64 + End int64 + Start int64 + type FileController struct + func NewFileController(filepath string, cl *int64, diskCache, speedLimit int, perm fs.FileMode) (*FileController, error) + func (fileController *FileController) Close() error + func (fileController *FileController) Copy(ctx context.Context, src io.Reader, id int, start int64, dataSize int64) error + func (fileController *FileController) Rateread(ctx context.Context, src io.Reader, buf []byte) (n int, err error) + func (fileController *FileController) SetWriteChangeEvent(d func(id int, n int)) + func (fileController *FileController) Sync() error + func (fileController *FileController) Truncate(size int64) error + type FileWriteAt struct + func NewFileWriteAt(id int, file *os.File, start int64, w func(id int, n int)) *FileWriteAt + func (fileat *FileWriteAt) Write(p []byte) (n int, err error) + type IoProxyReader struct + Reader io.Reader + Send func(n int) + func (r *IoProxyReader) Close() (err error) + func (r *IoProxyReader) Read(p []byte) (n int, err error) + type WaitGroupPool struct + func NewWaitGroupPool(size int) *WaitGroupPool + func (p *WaitGroupPool) Add() + func (p *WaitGroupPool) AllDone() <-chan error + func (p *WaitGroupPool) Count() int + func (p *WaitGroupPool) Done() + func (p *WaitGroupPool) Error(err error) + func (p *WaitGroupPool) Syne() + func (p *WaitGroupPool) Wait()