问题描述
我正在尝试在React js应用程序中使用Axios下载S3预签名URL Blob。
对于大于500MB的大文件,下载时间过长。
我尝试使用range-bytes在axios调用的标头中选择一个字节范围,但这并没有最终提高性能。
await axios({
url: '/api/presignedURL/bucket/' + data[selected[i]-1].bucketName + '/objectKey/' + data[selected[i]-1].key + '?method=GET',method: 'GET'
}).then(async (response) => {
console.log('File info')
console.log(data[selected[i]-1])
let byteCount = data[selected[i]-1].size
console.log('Byte Count')
console.log(byteCount)
await axios({
url: response.data,method: 'GET',responseType: 'blob',onDownloadProgress: updateProgress,headers: {
'Range': 'bytes=100-200/' + byteCount
}
}).then( async (response) => {
fileDownload(response.data,data[selected[i]-1].name);
setDownloadStatus(false);
setDownloadPercentStatus(0);
})
}).catch(() => {
setDownloadStatus(false);
setDownloadPercentStatus(0);
});
使用Axios从React JS应用程序中部分下载S3预签名URL文件以提高下载速度性能的最简单方法是什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)