feat: 添加常量 TempDir 并更新文件下载逻辑以支持跳过已存在文件的选项

This commit is contained in:
lixiangwuxian
2025-04-12 21:16:58 +08:00
parent b49b780da2
commit 7ba0f74b49
7 changed files with 20 additions and 13 deletions

View File

@@ -65,7 +65,7 @@ func normalizeURL(rawURL string) string {
}
// DownloadFile 下载文件到指定目录,返回带有正确扩展名的完整文件路径
func DownloadFile(urlStr string, dirPath string) (filepath string, err error) {
func DownloadFile(urlStr string, dirPath string, skipExist bool) (filepath string, err error) {
// 创建fasthttp客户端
client := &fasthttp.Client{
ReadTimeout: 30 * time.Second,