Gathering detailed insights and metrics for electron-download-manager
Gathering detailed insights and metrics for electron-download-manager
Gathering detailed insights and metrics for electron-download-manager
Gathering detailed insights and metrics for electron-download-manager
electron-dl-manager
A library for implementing file downloads in Electron with 'save as' dialog and id support.
angular-electron-download-manager
Manage downloadItems for angular from Electron's BrowserWindows without user interaction, allowing single file download and bulk downloading
electron-dl-downloader
Electron app simple and easy to use download manager, support for multiple downloads.Electron应用简单和易用的下载管理,支持多任务下载
tiny-runtime-injector
A library that helps you download complete, lightweight runtime environments like Node.js, Bun, and uv. It's useful for including minimal runtimes when building applications like Electron.
Manage downloadItems from Electron's BrowserWindows without user interaction, allowing single file download and bulk downloading
npm install electron-download-manager
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
121 Stars
68 Commits
50 Forks
1 Watchers
1 Branches
15 Contributors
Updated on Feb 13, 2025
Latest Version
2.1.2
Package Id
electron-download-manager@2.1.2
Unpacked Size
19.24 kB
Size
6.20 kB
File Count
5
NPM Version
6.9.0
Node Version
10.16.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Manage downloadItems from Electron's BrowserWindows without user interaction, allowing single file download and bulk downloading asynchronously
$ npm install electron-download-manager
Register the listener (that will catch all DownloadItems)
1const electron = require("electron"); 2const { app, BrowserWindow } = electron; 3 4const DownloadManager = require("electron-download-manager"); 5 6DownloadManager.register(); 7 8app.on("ready", () => { 9 let mainWindow = new BrowserWindow(); 10});
After registering you must wait until at least 1 window is created to call DownloadManager.download function
1const electron = require("electron"); 2const { app, BrowserWindow } = electron; 3 4const DownloadManager = require("electron-download-manager"); 5 6DownloadManager.register({ 7 downloadFolder: app.getPath("downloads") + "/my-app" 8}); 9 10app.on("ready", () => { 11 12 let mainWindow = new BrowserWindow(); 13 14 mainWindow.loadURL(`file://${__dirname}/app/index.html`); 15 16 //Single file download 17 DownloadManager.download({ 18 url: "https://i.imgur.com/H124sSq.jpg" 19 }, function (error, info) { 20 if (error) { 21 console.log(error); 22 return; 23 } 24 25 console.log("DONE: " + info.url); 26 }); 27 28});
This example downloads https://i.imgur.com/H124sSq.jpg file to user-downloads-folder/my-app/H124sSq.jpg
1const electron = require("electron"); 2const {app, BrowserWindow} = electron; 3 4const DownloadManager = require("electron-download-manager"); 5 6DownloadManager.register({downloadFolder: app.getPath("downloads") + "/my-app"});; 7 8app.on("ready", () => { 9 let mainWindow = new BrowserWindow(); 10 11 mainWindow.loadURL(`file://${__dirname}/app/index.html`); 12 13 var links = [ 14 "https://i.imgur.com/xineeuw.jpg", 15 "https://i.imgur.com/RguiWa6.jpg", 16 "https://i.imgur.com/JR4Z0aD.jpg", 17 "https://i.imgur.com/ccvEJO1.jpg", 18 "https://i.imgur.com/yqZoShd.jpg" 19 ]; 20 21 //Bulk file download 22 DownloadManager.bulkDownload({ 23 urls: links, 24 path: "bulk-download" 25 }, function (error, finished, errors) { 26 if (error) { 27 console.log("finished: " + finished); 28 console.log("errors: " + errors); 29 return; 30 } 31 32 console.log("all finished"); 33 }); 34 35}); 36 37
This example downloads 5 files to user-downloads-folder/my-app/bulk-downloads
Once you've registered the listener on the Main process at any time you can call the download function through electron's remote
1require("electron").remote.require("electron-download-manager").download({ 2 url: "https://i.imgur.com/H124sSq.jpg" 3}, function (error, info) { 4 if (error) { 5 console.log(error); 6 return; 7 } 8 9 console.log("DONE: " + info.url); 10});
Type: string
Default: app.getPath("downloads")]
Set a folder where all downloadItems will be downloaded to. It will also be the parent folder for individual folders of each download. Explained below in Download function.
By default, this "root" folder will be user's OS downloads folder (read about this)
If the file already exists in the location it will check the file's size against the size on the server, if it is lower than the server it will attempt to resume downloading the file. This is good for downloading large files. E.G Downloading a 200MB file and only 100MB downloaded (app closed/crashed) it will resume the download from where it left off automatically.
If the file size on the disk is the same as the server it will not download and return a successful callback.
Type: string
The url of the file to be downloaded
Type: string
Default: ""
Set a folder where this downloadItems will be downloaded to. This folder is relative to downloadFolder location set in the register function. By default it will be downloaded to root of downloadFolder which would be user download's folder.
Type: function
Emitted when an authenticating proxy is asking for user credentials.
1 DownloadManager.download({ 2 url: "https://i.imgur.com/H124sSq.jpg", 3 onLogin: (authInfo, callback) => { 4 callback('username', 'password'); 5 }, 6 }, function (error, info) { 7 if (error) { 8 console.log(error); 9 return; 10 } 11 12 console.log("DONE: " + info.url); 13 }); 14
Please see Class ClientRequest's 'login' event for detail.
Type: function
A function to be called whenever the file being downloaded progresses, this function will be constantly called with the updated value.
progress
an object with various metrics for the downloading file
{
downloaded // downloaded amount in ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
downloadedBytes // same as previous only in bytes for calculation if required (eg. 4061073)
progress // float progress of downloaing file (0 to 100)
remaining // remaining amount of file download in ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] (eg. 28.36 MB)
remainingBytes // same as previous only in bytes for calculation if required (eg. 28360919)
speed // download speed (eg. 311.3 KB/sec)
speedBytes // same as previous only in bytes for calculation if required (eg. 311296)
total // file size in ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] (eg. 32.42 MB)
totalBytes // same as previous only in bytes for calculation if required (eg. 32421992)
}
item
instance of DownloadItem class. Useful for pausing and cancelling among other things.
This feature currently exists only for single file downloads and hasn't been implemented (yet) for bulk processing.
Callback to be called when the download has reached a "done" state, which could mean two things either it was successful, or it failed.
if the download was successful the callback's error will be null
, otherwise it will contain the error message
url
returns the url of the downloaded file
filePath
location of where the file was saved
Type: array
Array of url
strings of the files to be downloaded
Type: string
Default: ""
Set a path to save all the bulk downloaded files. This folder is relative to downloadFolder location set in the register function. By default it will be downloaded to root of downloadFolder which would be user download's folder.
Type: function
A function to be called whenever a file has been downloaded or whenever a download failed.
finishedCount
integer. Represents the number of file successfully downloaded. example: 4
errorsCount
integer. Represents the number of file that couldn't be downloaded. example: 5
itemUrl
string. Represents the url
of the item.
This feature is really different as the
onProgress
feature for single files as it doesn't take the size in the calculation.
Callback to be executed when all downloadItems in this bulk process have been completed
error
will be null
if everything was successful
finished
is an array containing the url
of successfully downloaded items
failed
is an array containing the url
of failed downloaded items (if any)
Feel free to open Issues to ask questions about using this module, PRs are very welcome and encouraged.
MIT © Daniel Nieto, loosely based on code from Sindre Sorhus
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 12/15 approved changesets -- score normalized to 8
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More