Comments (4)
I have the same problem....
I try to receive 2 files in sequence, but the download event does not work intermittently...ㅠㅠ
SOMEBODY HELPME
from electron-dl.
This thing is just horrendously broken as everything electron.
from electron-dl.
Because of the unbelievable crappiness of electron that manages to f*ck up even a most basic task like downloading a file, I have come up with this nodejs
function that I use instead. Electron must be the only technology that manages to be even crappier than Node.js itself which is an incredible achievement in its own right, but whatever.
async function downloadFile(destPath, url) {
let cookies = await session.defaultSession.cookies.get({}),
header = cookies.map(c => `${c.name}=${c.value}`).join('; '),
_fs = require('fs'),
_http = require('http');
return new Promise((resolve, reject) => {
_http.get(url, { headers: { 'Cookie': header } }, ret => {
let file = _fs.createWriteStream(destPath);
ret.pipe(file);
file.on('finish', () => {
file.close();
resolve(destPath);
});
}).on('error', err => {
reject(err.message);
});
});
}
from electron-dl.
I think this is due to it spawning two listeners if you look at the source.
Give my package a try where it does handle multiple downloads:
https://github.com/theogravity/electron-dl-manager
from electron-dl.
Related Issues (20)
- Cannot find n ame 'Completed'. (new in 3.2) HOT 1
- Utilizing session.enableNetworkEmulation with ElectronDL HOT 1
- TypeError upon evaluation of download() arguments HOT 1
- how to use electron latest in electron-dl HOT 10
- Overwrite Option is flase. but, the same file name is specified in the directory, it is overwritten. HOT 2
- Status of tests and remote module HOT 1
- Downloads stuck on MacOS HOT 5
- Cannot read property 'getType' of null at getWindowFromWebContents
- cannot read 'getOwnerBrowserWindow' HOT 1
- Save-as dialog shows two periods before the SQLite file extension in the file type filter
- Property defination are different between index.d.ts and index.js
- Download URL with POST requests. HOT 1
- is there any sample project i can't make
- how can i make progress bar please help HOT 1
- When I change menu in navbar with route, it goes into loop
- how to post a json param
- Self signed certificate download not working.
- Get "Download Error" when using save as dialog and cancel button is pressed HOT 1
- Electron 30 support HOT 6
- Download start even `Save as` not appear
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from electron-dl.