Skip to content
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

saveAs option doesn't work #114

Open
iamisti opened this issue Jun 23, 2020 · 2 comments
Open

saveAs option doesn't work #114

iamisti opened this issue Jun 23, 2020 · 2 comments

Comments

@iamisti
Copy link

iamisti commented Jun 23, 2020

const win = BrowserWindow.getFocusedWindow();

const userDocumentPath = app.getPath("documents");
const pathToDestinationDir = `${userDocumentPath}/customfolder/${folder}`;

await download(win, url, {
    saveAs: true,
});

no matter what I do, i dont get the save as dialog. The file just directly gets downloaded into my download folder. Anyone knows why?

@papb
Copy link
Contributor

papb commented Jun 23, 2020

I assume you have const { download } = require('electron-dl') somewhere, right?

@theogravity
Copy link
Contributor

theogravity commented Mar 21, 2024

The electron-dl library uses setSaveDialogOptions() to show the "Save As" dialog which is what Electron believes you should use, but it is extremely buggy:

electron/electron#41640

Basically when you use it to show the save dialog, the download will continue in the background along with firing all the events associated with it.

I did find a workaround and wrote my own library to address that where events will only fire after the user has confirmed or denied the dialog:

https://github.com/theogravity/electron-dl-manager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants