GithubHelp home page GithubHelp logo

Comments (4)

joaomvfsantos avatar joaomvfsantos commented on May 9, 2024 4

I understand your point, I also agree this should be part of the DownloadItem, so an electron issue.

Just for reference, may be interesting to someone, as a workaround I'm using the onBeforeSendHeaders method off the default session's webRequest. This affects all requests which falls within the filter definition. Works for my use case, but maybe does not cover all.

from electron-dl.

sindresorhus avatar sindresorhus commented on May 9, 2024

I don't see any API for that in Electron: https://electron.atom.io/docs/api/download-item/

So you would have to get it added to Electron first: https://github.com/electron/electron/issues

(Please comment the Electron issue here if you do)

from electron-dl.

ericpyle avatar ericpyle commented on May 9, 2024

There was an issue (electron/electron#10582) made for Electron, but it got closed becaused they considered it to be a question rather than a feature request.

One contributor in that issue said

DownloadItem is handled by the Download Manager, the only API that seems to work with the download manager is contents.downloadURL(url):
https://github.com/electron/electron/blob/master/docs/api/web-contents.md#contentsdownloadurlurl

Looking at the C++ binding only a URL is allowed to be passed into the function:

electron/atom/browser/api/atom_api_web_contents.cc
Line 1061 in cc9771a

 void WebContents::DownloadURL(const GURL& url) { 

For allowing custom headers etc. to work an extension to the downloadURL function needs to be implemented.

from electron-dl.

sindresorhus avatar sindresorhus commented on May 9, 2024

Closing in favor of electron/electron#12883

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.