如何解决如何在React App中使用Axios从S3预签名URL分段下载BLOB文件?
我正在尝试在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 举报,一经查实,本站将立刻删除。