Failed to execute ‘readAsText‘ on ‘FileReader‘: parameter 1 is not of type ‘Blob‘.的解决方法
让它返回blob类型大概是这样子的。
·
把c.JSON(http.StatusOK,res)
替换成
resByte,_:=json.Marshal(res)
//
//c.JSON(http.StatusOK,res)
c.Header("Content-Disposition", "attachment; filename=file-name.txt")
c.Data(http.StatusOK, "application/octet-stream", resByte)
让它返回blob类型 大概是这样子的。
更多推荐
所有评论(0)