多线程分片下载

This commit is contained in:
Shikong 2023-07-24 00:15:00 +08:00
parent 74cccba197
commit 450e4940b2

View File

@ -166,7 +166,7 @@ func (d *Downloader) Run() error {
fByte := make([]byte, d.FileSize)
if exists(path) {
tmpFile, err = os.OpenFile(path, os.O_RDWR, 0)
tmpFile, err = os.OpenFile(path, os.O_RDWR|os.O_TRUNC|os.O_CREATE, 0)
if err != nil {
return err
}