New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multiple simultaneous downloads possible ? #66
Comments
electron-dl-multi.zip |
We implemented downloading an array of file objects like this and it works for us. Hopefully, you can garner how to extract what you need from this. ipcMain.on("download-files", async (event, files) => {
const downloadLocation = app.getPath("userData");
const promises = files.map(file =>
download(mainWindow, file.url, {
saveAs: false,
directory: downloadLocation,
onProgress: progress => {
event.sender.send("download-progress", { progress, file });
}
})
);
await Promise.all(promises);
}); |
The code above doesn't work for me, the promises get resolved immediately. Reducing files array to a single item and reusing the same code works perfectly. |
Frustrating that the tip right above me is necessary. These promises shouldn't be getting resolved immediately! Might submit a pull if I get around to it |
Got bit by the same thing. Did you ever get around to submitting that Pull Request? |
I wrote a library that handles multiple downloads and fixes a lot of issues around using a save as dialog: |
It is mentioned in docs that in download function , url is string
download(BrowserWindow.getFocusedWindow(), args.url)
Is there a way to download a given array of files simultaneously ? and have one promise/callback for all
Can anyone help with promise chain to achieve this ?
I asked the question here stackoverflow
Can someone suggest fix for the code ?
The text was updated successfully, but these errors were encountered: