-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested
Description
Hello,
Thanks for the great library.
I am facing problem for displaying the download progress
here's my code:
const files = response.data.files
totalBytes = getTotalBytes(files)
const requests = files.map((file) => fetch(file.url)
.then(async (response) => {
const reader = response.body.getReader()
const chunks = []
while (true) {
const { done, value } = await reader.read();
if (done) {
break;
}
chunks.push(value)
receivedBytes += value.length;
progress(receivedBytes)
}
return new Blob(chunks) //--> dont know if this is the correct way
})
.catch(error => {
throw new Error(error.message + "\nURL: " + file.url)
})
)
const responses = await Promise.all(requests)
console.log("response: ", responses) //--> this works and output like: (11) [Blob, Blob, Blob, Blob, Blob, Blob, Blob, Blob, Blob, Blob, Blob]
const blob = await downloadZip(responses); //--> not working
const link = document.createElement("a")
link.href = URL.createObjectURL(blob)
link.download = fileName + ".zip"
link.click()
URL.revokeObjectURL(link.href)
link.remove()
I've tried solution mentioned here: #19
but it does not calculate when files are downloaded but rather I think when making zip file
Any help on this matter Please
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestquestionFurther information is requestedFurther information is requested