package utils

import (
	"github.com/gofiber/fiber/v2/log"
	"io"
	"net/http"
)

// DownloadFile
// @description: 下载文件
// @param url
// @return bs
// @return err
func DownloadFile(url string) (bs []byte, err error) {
	resp, err := http.Get(url)
	if err != nil {
		log.Errorf("读取文件流失败: %v", err.Error())
		return
	}
	defer resp.Body.Close()

	bs, err = io.ReadAll(resp.Body)
	return
}
