mirror of
https://github.com/nxtrace/nali
synced 2024-11-22 18:34:22 +00:00
2f1d16408c
Signed-off-by: zu1k <i@zu1k.com>
24 lines
490 B
Go
24 lines
490 B
Go
package download
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/zu1k/nali/pkg/common"
|
|
)
|
|
|
|
func Download(filePath string, urls ...string) (data []byte, err error) {
|
|
_ = urls[0]
|
|
|
|
data, err = common.GetHttpClient().Get(urls...)
|
|
if err != nil {
|
|
log.Printf("文件下载失败,请手动下载解压后保存到本地: %s \n", filePath)
|
|
log.Println("下载链接:", urls)
|
|
return
|
|
}
|
|
|
|
if err := common.SaveFile(filePath, data); err == nil {
|
|
log.Println("文件下载成功:", filePath)
|
|
}
|
|
return
|
|
}
|