minioObject, getObjErr := minioClient.GetObject(ConfigUtil.MinioBucket, key, minio.GetObjectOptions{})
if getObjErr != nil {
c.JSON(http.StatusOK, gin.H{"success": false, "info": "获取文件信息异常!" + getObjErr.Error()})
return
}

buf := bytes.NewBuffer(nil)
io.Copy(buf, minioObject)

c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", originName))
c.Data(http.StatusOK, "application/octet-stream", buf.Bytes())

相关文章:

  • 2021-08-28
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-02-20
  • 2022-03-07
  • 2021-11-28
  • 2022-12-23
猜你喜欢
  • 2021-04-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
相关资源
相似解决方案