4

I am trying to download a S3 Presigned URL Blob using Axios in a react js app.

The download is taking too long for large file sizes like > 500MB.

I tried using range-bytes to select a range of bytes in the headers of the axios call below which didn't end up increasing the performance.

            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);
            });

What is the simplest way to download S3 presigned URL files in parts to improve download speed performance using Axios from a React JS App?

Drew Gallagher
  • 746
  • 2
  • 9
  • 18

0 Answers0