Giter Site home page Giter Site logo

Comments (8)

jonesaustindev avatar jonesaustindev commented on July 3, 2024 1

For anyone in the future having the same issue with downloading multiple files, I went the path of doing them in order instead of setting up promises to resolve every file at once. Here's what I ended up with that worked for my use case:

      async function downloadFiles(assetUrls: string[]) {
        for (const url of assetUrls) {
          await download(mainWindow, url, {
            directory: assetsDirectory,
            saveAs: false,
            showBadge: false,
          });
        }
      }

from electron-dl.

sindresorhus avatar sindresorhus commented on July 3, 2024

From what I can tell, our logic is sound:

electron-dl/index.js

Lines 54 to 56 in d87af7a

if (!options.saveAs) {
item.setSavePath(filePath);
}
So this sounds like an Electron bug. I would recommend upgrading to the latest Electron version.

from electron-dl.

vitorizkiimanda avatar vitorizkiimanda commented on July 3, 2024

From what I can tell, our logic is sound:

electron-dl/index.js

Lines 54 to 56 in d87af7a

if (!options.saveAs) {
item.setSavePath(filePath);
}

So this sounds like an Electron bug. I would recommend upgrading to the latest Electron version.

well I'll try to update the electron to the latest. Thanks. Gonna update here about the result

from electron-dl.

basilky avatar basilky commented on July 3, 2024

I can confirm this issue on Electron 10.3.1(Windows, Mac and Linux). Works fine with Electron 9.3.1(tested on Linux and Windows).

from electron-dl.

vitorizkiimanda avatar vitorizkiimanda commented on July 3, 2024

I can confirm this issue on Electron 10.3.1(Windows, Mac and Linux). Works fine with Electron 9.3.1(tested on Linux and Windows).

thanks for the info.. i can confirm the bug appears when download multiple files in parallel ( appears in electron 10, 8, 7 ).
IF only download single file the bug doesn't appear. My solution right now is by queue the download so only 1 download in a time. But its kinda messy.

any robust solution for multiple download in parallel?

from electron-dl.

jonesaustindev avatar jonesaustindev commented on July 3, 2024

@vitorizkiimanda @sindresorhus any update on this? I am facing a similar issue with downloading multiple files and getting the Save As dialog. Using Electron 10.1.3

from electron-dl.

basilky avatar basilky commented on July 3, 2024

Maybe related to this electron bug?
electron/electron#23273

from electron-dl.

vitorizkiimanda avatar vitorizkiimanda commented on July 3, 2024

For anyone in the future having the same issue with downloading multiple files, I went the path of doing them in order instead of setting up promises to resolve every file at once. Here's what I ended up with that worked for my use case:

      async function downloadFiles(assetUrls: string[]) {
        for (const url of assetUrls) {
          await download(mainWindow, url, {
            directory: assetsDirectory,
            saveAs: false,
            showBadge: false,
          });
        }
      }

well thanks @jonesaustindev , i created same approach with different style and it solve the problem ( eventhough not really solved the bug )

note : still waiting for the real solution for the bug

from electron-dl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.