We are trying to look at a solution to upload large files through a React web application. We are thinking of File Streaming solution, to reduce the time take for upload as files can be as large as 20 GB. I had created converted the file uploaded through React File Upload UI Component, converted it to ReadableStream, and used it as the RequestBody.
As I know that Transfer-Encoding is a Restricted header in an Http Request, I didnt set it manually, but have to allow the user agent to set it. Based on other answers I found on StackOverflow, I hoped that a ReadableStream in the RequesteBody would make the user agent set the Request Header 'Transfer-Encoding' : 'chunked' request header, but I dont see that. Below is the piece of code I used:
const blob = new Blob([tarFile])
const tarStream = blob.stream()
post(upgradeUrl, tarStream, oidcUser.access_token, {
'Content-Type': 'text/plain'
}).then(
() => {
console.log('upload completed')
},
(error) => {
setErrorMessage(getGlopErrorMessage(error, t))
}
)
}
Does anyone know the correct way of doing this? Thanks.