You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the bulkDownload downloads all files of my array,
but it is not triggering the callback, the function body is completly ignored sometimes
constdl=app.require("electron-download-manager")functiondownloadSiteColorURLFILELinksFiles(){constsiteColorURLFILELinksFilesFromList=$("#chooseColors ul .isURLfromURLFILE");letsiteColorURLFILELinksFiles=[];siteColorURLFILELinksFilesFromList.each(function(){siteColorURLFILELinksFiles.push($(this).html());});console.log(siteColorURLFILELinksFiles);console.log("downloading now all files from list");dl.bulkDownload({urls: siteColorURLFILELinksFiles,path: ``},function(error,finished,errors){if(error){console.log("finished: "+finished);console.log("error: "+error);console.log("errors: "+errors);}console.log("all files downloaded");colorFileList.append("<li class='li-seperator'>"+"downloaded files are:"+"</li>");constsiteColorURLFILElinksFilesDownloaded=fs.readdirSync(__dirname+colorSiteDownloadDIR,"utf8");siteColorURLFILElinksFilesDownloaded.forEach(file=>{colorFileList.append("<li class='isFILE'>"+__dirname+colorSiteDownloadDIR+file+"</li>");});});console.log("after dl.bulkDownload function")siteColorURLFILELinksFiles=[]}
the console.log("finished/error etc") is not fired, also the console.log("all files downloaded) is not fired, but all files are downloaded, i see all in the download folder.
electron-download-manager just doesn't know when all files are downloaded sometimes.
well, it actually happes randomly, doesnt matter if the files exist before or not ...
any idea?
// i wanna add all downloaded files to a ul to read them later with the fs module
The text was updated successfully, but these errors were encountered:
Can confirm this bug, it seems to happen quite often here.
EDIT: For anyone interested, I've worked around the problem like this. It might contain some errors as I've only been testing it for 15min in my implementation, but it might help you out as well.
const length = downloadUrls.length;
let downloaded = 0;
downloadUrls.forEach(url => {
DownloadManager.download({ url }, (err, info) => {
if (err) {
console.log(err);
return;
}
// When downloaded, increase the download counter and remove the url from the downloadUrls
downloaded++;
const index = downloadUrls.findIndex(x => x === url);
downloadUrls.splice(index, 1);
// Check if every file has been downloaded, this replaces the callback
if (length === downloaded) {
// Reset download counter
downloaded = 0;
}
})
});
the bulkDownload downloads all files of my array,
but it is not triggering the callback, the function body is completly ignored sometimes
the console.log("finished/error etc") is not fired, also the console.log("all files downloaded) is not fired, but all files are downloaded, i see all in the download folder.
electron-download-manager just doesn't know when all files are downloaded sometimes.
well, it actually happes randomly, doesnt matter if the files exist before or not ...
any idea?
// i wanna add all downloaded files to a ul to read them later with the fs module
The text was updated successfully, but these errors were encountered: