uniapp,接口返回文件流,APP开发,前端如何处理流,并保存?
看你这个流文件是要做什么,是要下载就是按照网上方法创建一个a标签,然后模拟点击a标签,执行下载就行了,
const file = new File([res], res.name, { type: res.type })
const downLoadUrl = URL.createObjectURL(file)
const link = document.createElement('a')
link.href = downLoadUrl
link.download = "name"
link.click()如果说你这个流是一个图片什么得要在界面展示就用 window.URL.createObjectURL(file)
将流转化为一个路径就可以在界面上展示了
小文件用 uni.request
大文件用 uni.downloadFile :