Download electron
Author: c | 2025-04-25
Download electronics workbench for free (Windows) Windows Windows Users' choice Download electronics workbench Download electronics workbench Most people looking for Electronics workbench downloaded: Lucid Electronics Workbench Download 4 on 4 votes. Electronic Workbench Download Win 10 - r2fzw.
GitHub - quicksnap/electron-download: downloads a electron
Electron-downloadDownloads an Electron release zip from GitHub.Used by electron-prebuilt and electron-packagerUsageNote: Requires Node >= 4.0 to run.$ npm install --global electron-download$ electron-download --version=0.31.1const download = require('electron-download')download({ version: '0.25.1', arch: 'ia32', platform: 'win32', cache: './zips'}, function (err, zipPath) { // zipPath will be the path of the zip that it downloaded. // If the zip was already cached it will skip // downloading and call the cb with the cached zip path. // If it wasn't cached it will download the zip and save // it in the cache path.})If you don't specify arch or platform args it will use the built-in os module to get the values from the current OS. Specifying version is mandatory. If there is a SHASUMS256.txt file available for the version, the file downloaded will be validated against its checksum to ensure that it was downloaded without errors.You can also use electron-download to download the chromedriver, ffmpeg,mksnapshot, and symbols assets for a specific Electron release. This can beconfigured by setting the chromedriver, ffmpeg, mksnapshot, orsymbols property to true in the specified options object. Only one ofthese options may be specified per download call.You can force a re-download of the asset and the SHASUM file by setting theforce option to true.If you would like to override the mirror location, three options are available. The mirror URL is composed as url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME.You can set the ELECTRON_MIRROR or NPM_CONFIG_ELECTRON_MIRROR environment variable or mirror opt variable to use a custom base URL for grabbing Electron zips. The same pattern applies to ELECTRON_CUSTOM_DIR and ELECTRON_CUSTOM_FILENAME:## Electron Mirror of ChinaELECTRON_MIRROR=" or for a local mirrorELECTRON_MIRROR=" can set ELECTRON_MIRROR in .npmrc as well, using the lowercase name:electron_mirror= locationThe location of the cache depends on the operating system, the defaults are:Linux: $XDG_CACHE_HOME or ~/.cache/electron/MacOS: ~/Library/Caches/electron/Windows: $LOCALAPPDATA/electron/Cache or
GitHub - keybase/electron-download: downloads a electron
@tomjs/electron-devtools-installer English | 中文Install Chrome extension for Electron, support cjs/esm.This library is based on Samuel Attard's electron-devtools-installer and JonLuca De Caro's electron-extension-installer, with some modifications and added small features. It provides support for esm and cjs to support for Electron v28+.For Chrome DevTools installation, please visit the Official Documentation.FeaturesSupport cjs/esmSupport Electron v28+ to use esmInstall# pnpmpnpm add @tomjs/electron-devtools-installer# yarnyarn add @tomjs/electron-devtools-installer# npmnpm add @tomjs/electron-devtools-installerUsageesm { installExtension(VUEJS_DEVTOOLS) // equals to installExtension("nhdogjmejiglipccpnnnanhbledajbpd") .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});">import { app } from 'electron';import { installExtension, VUEJS_DEVTOOLS } from '@tomjs/electron-devtools-installer';// Install Vue.js DevToolsapp.whenReady().then(() => { installExtension(VUEJS_DEVTOOLS) // equals to installExtension("nhdogjmejiglipccpnnnanhbledajbpd") .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});cjs { installExtension(VUEJS_DEVTOOLS) .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});">const { app } = require('electron');const { installExtension, VUEJS_DEVTOOLS } = require('@tomjs/electron-devtools-installer');// Install Vue.js DevToolsapp.whenReady().then(() => { installExtension(VUEJS_DEVTOOLS) .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});DocumentationAPI Document provided by jsdocs.io.index.d.ts provided by unpkg.com.APIPreset Chrome Extensions IDThe following is a list of preset Chrome extensions ID:IDNameANGULAR_DEVTOOLSAngular DevToolsAPOLLO_CLIENT_TOOLSApollo Client DevtoolsBACKBONE_DEBUGGERBackbone DebuggerEMBER_INSPECTOREmber InspectorJQUERY_DEBUGGERjQuery DebuggerMOBX_DEVTOOLSMobX DevToolsPREACT_DEVELOPER_TOOLSPreact Developer ToolsREACT_DEVELOPER_TOOLSReact Developer ToolsREDUX_DEVTOOLSRedux DevToolsVUEJS_DEVTOOLSVue.js DevToolsVUEJS_DEVTOOLS_BETAVue.js devtools (beta)VUEJS_DEVTOOLS_V5Vue.js devtools (v5)VUEJS_DEVTOOLS_V6Vue.js devtools (v6)installExtension(extensionIds[, options])install chrome extension for electronextensionIds: string | string[] - Chrome extension idoptions: Install extension optionsloadExtensionOptions: session.LoadExtensionOptionsforceDownload: boolean - Force to download the extension even if it's already installed, default is falsesource: 'chrome' | 'unpkg' | 'jsdelivr' | 'npmmirror' - Download url source. When the OS language is zh_CN , the default value is npmmirror, otherwise it is chrome.session: 'string' | 'Electron.Session' - The target session on which the extension shall be installed, default is session.defaultSession.Returns Promise - extension name/version, etc.downloadExtension(extensionId[, options])download chrome extension for electronextensionId: string - Chrome extension idoptions: Download extension optionsforce: boolean - Force to download the extension even if it's already installed, default is falseunzip: boolean - Whether to unzip the downloaded file, default is trueattempts: number - Number of attempts to download the extension, default is 5outPath: string - The path to save the downloaded extension, default is path.join(app.getPath('userData'), 'extensions')source: 'chrome' | 'unpkg' | 'jsdelivr' | 'npmmirror' - Download urlElectronic Filipino Bible Download - The Electronic
Within any registered window.Each time a new download is started, the next callback will include it. The progress percentage could therefore become smaller again.This callback provides the same data that is used for the progress bar on the app icon.{ percent: 0.1, transferredBytes: 100, totalBytes: 1000}onCancelType: FunctionOptional callback that receives the download item for which the download has been cancelled.onCompletedType: FunctionOptional callback that receives an object with information about an item that has been completed. It is called for each completed item.{ filename: 'file.zip', path: '/path/file.zip', fileSize: 503320, mimeType: 'application/zip', url: ' booleanDefault: falseReveal the downloaded file in the system file manager, and if possible, select the file.showBadgeType: booleanDefault: trueShow a file count badge on the macOS/Linux dock/taskbar icon when a download is in progress.showProgressBarType: booleanDefault: trueShow a progress bar on the dock/taskbar icon when a download is in progress.overwriteType: booleanDefault: falseAllow downloaded files to overwrite files with the same name in the directory they are saved to.The default behavior is to append a number to the filename.dialogOptionsType: SaveDialogOptionsDefault: {}Customize the save dialog.If defaultPath is not explicity defined, a default value is assigned based on the file path.DevelopmentAfter making changes, run the automated tests:And before submitting a pull request, run the manual tests to manually verify that everything works:Relatedelectron-debug - Adds useful debug features to your Electron appelectron-context-menu - Context menu for your Electron appelectron-store - Save and load data like user settings, app state, cache, etcelectron-unhandled - Catch unhandled errors and promise rejections in your Electron app. Download electronics workbench for free (Windows) Windows Windows Users' choice Download electronics workbench Download electronics workbench Most people looking for Electronics workbench downloaded: Lucid Electronics Workbench Download 4 on 4 votes. Electronic Workbench Download Win 10 - r2fzw.Download Hacking Electronics: Learning Electronics with
首页 / 前端技术文章 / npm 包 electron-download-manager 使用教程 npm 包 electron-download-manager 使用教程 2021-02-08 18:50 阅读时长 6 分钟读完 介绍electron-download-manager 是一个用于 Electron 应用程序的下载管理器,可以方便地进行下载操作。它包含下载队列、下载速度控制、断点续传等功能,使用起来非常方便。安装使用 npm 进行安装:npm install electron-download-manager --save基本使用在你的 Electron 主进程中,你需要将 electron-download-manager 引用进来,然后使用以下代码创建一个下载:const { download } = require('electron-download-manager');const url = ' url);其中 BrowserWindow.getFocusedWindow() 是 electron 的一个内置方法,用于获取当前活动的窗口实例。你也可以使用其他方法获取窗口实例。然后,在你的渲染进程中,你可以监听下载事件:const { ipcRenderer } = require('electron');ipcRenderer.on('download complete', (event, item) => { console.log(item);});在下载完成后,会在渲染进程中触发一个 download complete 事件,我们可以通过监听这个事件获取下载完成的文件信息。高级用法设定下载路径你可以设定下载的路径,让它下载到你指定的文件夹中。只需要修改上面的代码:const { download } = require('electron-download-manager');const url = ' options = { directory: '~/Downloads'};download(BrowserWindow.getFocusedWindow(), url, options);其中 options 对象包含一个 directory 属性,可以指定下载的目录,这里我们设为桌面上的 Downloads 文件夹。多个下载进程你可以同时进行多个下载,只需要为每个下载设置不同的 id 即可:-- -------------------- ---- ------------ - -------- - - ------------------------------------------ ---- - ---------------------------------------- ---- - ---------------------------------------- ------- - - ---------- -------------------- ----- - ------------------------------------------ ----- -------------- ----- - ------------------------------------------ ----- ---------这里我们创建了两个下载,每个下载都有一个不同的 id。事件回调你可以监听下载事件的回调函数,以便在下载完成后进行一些操作:-- -------------------- ---- ------------ - -------- - - ------------------------------------------ --- - --------------------------------------- ------- - - ---------- -------------------- ---- - ------------------------------------------ ---- ------------------------ ------- ------ -- - --------------------- -- ------- ----------这里我们监听了 done 事件,当下载完成后就会触发这个事件,并在控制台中打印状态信息。断点续传通过下载管理器,我们可以轻松地进行断点续传操作,确保下载过程中出现错误时不会浪费我们已经下载的数据。-- -------------------- ---- ------------ - -------- - - ------------------------------------------ --- - --------------------------------------- ------- - - ---------- -------------- ------- ----------- ---- - ------------------------------------------ ---- -------------------------- ------- ------ -- - --------------------- -- ------------- ----------------------------- ------- ------ -- - --------------------- -- -- ------------- ----------这里我们为下载操作添加了一个 resume 属性,它设定为 true 后,就可以进行断点续传操作了。同时,我们还监听了 resume 和 progress 两个事件,用于响应断点续传操作和下载进度。示例代码以下是一个完整的示例代码,用于下载一个文件并在下载完成后打印其状态信息。你可以在自己的 Electron 应用程序中使用这个代码。-- -------------------- ---- ------------ - -------- - - ------------------------------------------ - ----------- - - ------------------------- --- - --------------------------------------- ------- - - ---------- -------------- ------- ----------- ---- - ------------------------------------------ ---- -------------------------- ------- ------ -- - --------------------- -- ------------- ----------------------------- ------- ------ -- - --------------------- -- -- ------------- ------------------------- ------- ------ -- - --------------------- -- ------- ------- -------------------------- ---------- ---------------------------------- ---------- ------- ----- -- - ---------------------结论electron-download-manager 是一个非常方便的下载管理器,在 Electron 应用程序中使用它可以轻松处理下载操作,并可以进行断点续传等高级操作。在开发 Electron 应用程序时,使用它可以大大提高开发效率,你们可以尝试使用它来进行开发。来源:JavaScript中文网 ,转载请注明来源electron/chromedriver: Download ChromeDriver for Electron
Electron-dlSimplified file downloads for your Electron appWhy?One function call instead of having to manually implement a lot of boilerplate.Saves the file to the users Downloads directory instead of prompting.Bounces the Downloads directory in the dock when done. (macOS)Handles multiple downloads.Shows badge count (macOS & Linux only) and download progress. Example on macOS:InstallRequires Electron 30 or later.UsageRegister it for all windowsThis is probably what you want for your app.import {app, BrowserWindow} from 'electron';import electronDl from 'electron-dl';electronDl();let mainWindow;(async () => { await app.whenReady(); mainWindow = new BrowserWindow();})();Use it manuallyThis can be useful if you need download functionality in a reusable module.import {BrowserWindow, ipcMain} from 'electron';import {download, CancelError} from 'electron-dl';ipcMain.on('download-button', async (event, {url}) => { const win = BrowserWindow.getFocusedWindow(); try { console.log(await download(win, url)); } catch (error) { if (error instanceof CancelError) { console.info('item.cancel() was called'); } else { console.error(error); } }});APIIt can only be used in the main process.electronDl(options?)windowType: BrowserWindow | WebContentsViewThe window to register the behavior on. Alternatively, a WebContentsView can be passed.urlType: stringThe URL to download.optionsType: objectsaveAsType: booleanDefault: falseShow a Save As… dialog instead of downloading immediately.Note: Only use this option when strictly necessary. Downloading directly without a prompt is a much better user experience.directoryType: stringDefault: User's downloads directoryThe directory to save the file in.Must be an absolute path.filenameType: stringDefault: downloadItem.getFilename()Name of the saved file.This option only makes sense for electronDl.download().errorTitleType: stringDefault: 'Download Error'Title of the error dialog. Can be customized for localization.Note: Error dialog will not be shown in electronDl.download(). Please handle error manually.errorMessageType: stringDefault: 'The download of {filename} was interrupted'Message of the error dialog. {filename} is replaced with the name of the actual file. Can be customized for localization.Note: Error dialog will not be shown in electronDl.download(). Please handle error manually.onStartedType: FunctionOptional callback that receives the download item.You can use this for advanced handling such as canceling the item like item.cancel() which will throw electronDl.CancelError from the electronDl.download() method.onProgressType: FunctionOptional callback that receives an object containing information about the progress of the current download item.{ percent: 0.1, transferredBytes: 100, totalBytes: 1000}onTotalProgressType: FunctionOptional callback that receives an object containing information about the combined progress of all download items doneElectronic Calculator Download - Electronic Calculator2 is
"buildResources": "public" }}The end result should be:{ "name": "gitometer", "version": "0.1.0", "private": true, "dependencies": { "electron": "^1.7.5", "eslint": "^4.5.0", "eslint-config-airbnb": "^15.1.0", "eslint-plugin-import": "^2.7.0", "eslint-plugin-jsx-a11y": "^6.0.2", "eslint-plugin-react": "^7.3.0", "react": "^15.6.1", "react-dom": "^15.6.1", "react-scripts": "1.0.11" }, "devDependencies": { "electron-builder": "^19.24.1" }, "homepage": "./", "main": "src/start.js", "scripts": { "start": "nf start -p 3000", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "electron": "electron .", "electron-start": "node src/start-react", "react-start": "BROWSER=none react-scripts start", "pack": "build --dir", "dist": "npm run build && build", "postinstall": "install-app-deps" }, "build": { "appId": "com.electron.electron-with-create-react-app", "win": { "iconUrl": " }, "directories": { "buildResources": "public" } }}Now create a file named Procfile in the project root folder, with this content:react: npm run react-startelectron: npm run electron-startEnough with the setup!Let’s now start writing some code.src/start.jsconst { app, BrowserWindow } = require('electron')const path = require('path')const url = require('url')let mainWindowfunction createWindow() { mainWindow = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true } }) mainWindow.loadURL( process.env.ELECTRON_START_URL || url.format({ pathname: path.join(__dirname, '/../public/index.html'), protocol: 'file:', slashes: true }) ) mainWindow.on('closed', () => { mainWindow = null })}app.on('ready', createWindow)app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() }})app.on('activate', () => { if (mainWindow === null) { createWindow() }})src/start-react.jsconst net = require('net')const childProcess = require('child_process')const port = process.env.PORT ? process.env.PORT - 100 : 3000process.env.ELECTRON_START_URL = ` client = new net.Socket()let startedElectron = falseconst tryConnection = () => { client.connect({ port }, () => { client.end() if (!startedElectron) { console.log('starting electron') startedElectron = true const exec = childProcess.exec exec('npm run electron') } })}tryConnection()client.on('error', () => { setTimeout(tryConnection, 1000)})Start upThat’s it!Runnpm startand you should see the React sample app coming up in a native app:Thanks toThis post was heavily inspired by Written on Aug 25, 2017 I wrote 19 books to help you become a better developer: HTML HandbookNext.js Pages Router HandbookAlpine.js HandbookHTMX HandbookTypeScript HandbookReact HandbookSQL HandbookGit Cheat SheetLaravel HandbookExpress HandbookSwift HandbookGo HandbookPHP HandbookPython HandbookLinux Commands HandbookC HandbookJavaScript HandbookCSS HandbookNode.js Handbook ...download them all now!@electron-builder/electron-download - npm
YT DownloadDownloads videos from Youtube.Table of contentsYT DownloadTable of contentsNode.js and ElectronFFmpegQuickstartInitializeStarting YT DownloadCreate packageCreate installerChangelogv1.5.42v1.5.41v1.5.32v1.5.31v1.5.3v1.5.1v1.4.0v1.0.0Node.js and ElectronThis Software uses Node.js and Electron to utilize JavaScript, HTML, and CSS for cross platform desktop apps.FFmpegFFmpeg is required to download HD quality videos and convert files. YT Download also works with limited functionality without FFmpeg.if FFmpeg was not found, YT Download will ask you if you want to download it. In this case you don't need to worry about setting the environment variables.QuickstartInitializeor with yarnStarting YT DownloadTo start the release version enteror with yarnTo start the debug version with active Chrome Developer Mode enteror with yarnCreate packageor with yarnCreate installeror with yarnChangelogv1.5.42Fixed an issue that prevented animation of elementsFixed an issue caused by a deprecated ytdl-core versionv1.5.41Update to Electron 17.0.1Updated several further dependencies.Precompiled binary packages for Linux are available again.If the download directory doesn't exist, it will be created now.Dependency loading has been slightly optimized.v1.5.32Fix for slow downloads... again.v1.5.31Fix for slow downloads.v1.5.3Update due to YouTube API changes.v1.5.1Render process runs now in context isolation.Support for Electron > 11.Removed unused code.Updated dependencies (e.g. Electron 12.0.5).v1.4.0The mess that was ./main/ffmpeg.js was fixed.Audio and video downloads are now shown in one progress bar.Added proper progress for media conversion.The download speed is now displayed.Added support for hardware accelerated encoding. (Tries to find the optimal mode automatically)Some UI improvements.v1.0.0New UI build on Materialize frameworkDownloading from Youtube in HD quality if possibleConverting to MP3, MKV, WEBM, MOV and MPEGSelect quality of the downloadEasy package and installer building with Electron. Download electronics workbench for free (Windows) Windows Windows Users' choice Download electronics workbench Download electronics workbench Most people looking for Electronics workbench downloaded: Lucid Electronics Workbench Download 4 on 4 votes. Electronic Workbench Download Win 10 - r2fzw. Electron, free download. Electron: Electron. Overview. Electron is a Shareware software in the category Miscellaneous developed by Electron. The latest version of Electron is currently
Electronic Library Downloads - Tiko Electronic
Dari Electron bisa Anda lihat di bawah ini:Node.jsBenar sekali, sebenarnya Electron ini bekerja dengan menggunakan Node.js dan Chronium. Mudahnya, Electron bekerja dengan menjalankan sebuah browser. Jadi, kemudahan yang ditawarkan ialah membuat aplikasi dari tampilan web dan mengubahnya menjadi Native Desktop App.Multi-PlatformKelebihan lainnya dari Electron ialah kemampuan yang dapat berjalan di berbagai sistem operasi, namun bukan hanya itu saja, melainkan aplikasi yang dibuat juga dapat berjalan di platform berbeda. Sebut saja Anda dapat mengembangkan versi desktop untuk Linux, Mac, PC, dan Mobile.Mendukung Bahasa PomrogramanBukan hanya dapat menjalankan bahasa JavaScript saja, program ini juga dapat menjalankan dan mengelola berbagai macam bahasa seperti CSS dan HTML. Kedua bahasa ini merupakan bahasa yang paling banyak digunakan untuk membangun web atau situs website.Kelebihan lainnya ialah kemudahan menggunakan fitur dengan antarmuka mudah dan sederhana, Electron didesain dengan antarmuka yang sederhana yang akan memudahkan pengembang untuk menjelajahi fiturnya.Electron menjadi salah satu program yang setidaknya harus dikuasai oleh pengembang, baik pemula maupun yang telah lama di bidangnya. Program ini memiliki kemampuan tingkat tinggi yang handal. Link download Electron terbaru bisa Anda dapatkan di bawah ini:[Windows 32-Bit][Windows 64-Bit]Editor:GitHub - we-fork/electron-download: downloads a electron
These libraries not only help organize your code but also make it easier to test and debug asynchronous actions. By isolating side effects, you can more easily track down where things might be going wrong.Lastly, don’t underestimate the power of community resources. Platforms like Stack Overflow, GitHub discussions, and even dedicated forums for React and Electron can be goldmines for troubleshooting specific issues. Often, someone else has encountered the same problem and found a solution that could save you hours of frustration.In conclusion, while debugging React and Electron applications may seem challenging at first, employing a combination of built-in tools, effective logging, and community support can significantly ease the process. By embracing these techniques, you’ll not only enhance your debugging skills but also improve the overall quality of your applications. So, roll up your sleeves, dive into the code, and happy debugging!Packaging and Distributing Your React and Electron Desktop AppWhen it comes to packaging and distributing your React and Electron desktop app, the process can feel a bit daunting at first, but with the right approach, it becomes a manageable task. Once you’ve built your app and are ready to share it with the world, the next step is to package it into a format that users can easily install on their machines. This is where Electron shines, as it provides a robust framework for creating cross-platform applications.To start, you’ll want to use a tool called Electron Builder. This handy utility simplifies the packaging process significantly. By adding it to your project, you can automate much of the work involved in creating installers for different operating systems. First, you’ll need to install Electron Builder via npm. Just run `npm install electron-builder –save-dev` in your terminal, and you’re on your way. Once installed, you can configure it in your `package.json` file. This is where you specify details like the app name, version, and the files that should be included in the final build.As you dive into the configuration, you’ll notice that Electron Builder supports various formats for distribution, including .exe for Windows, .dmg for macOS, and .deb or .rpm for Linux. This flexibility means you can reach a wider audience without having to create separate builds for each platform manually. After setting up your configuration, you can run a simple command to build your app. Just type `npm run build`, and Electron Builder will take care of the rest, generating the necessary files for distribution.Once your app is packaged, the next step is distribution. You have several options here, depending on how you want to reach your users. One popular method is to host your app on a website or a cloud storage service. This way, users can download the installer. Download electronics workbench for free (Windows) Windows Windows Users' choice Download electronics workbench Download electronics workbench Most people looking for Electronics workbench downloaded: Lucid Electronics Workbench Download 4 on 4 votes. Electronic Workbench Download Win 10 - r2fzw.Electronic Workbench - Download Electronic Workbench 5.12
1 Electron volts = 0 Newton meters 10 Electron volts = 0 Newton meters 2500 Electron volts = 0 Newton meters 2 Electron volts = 0 Newton meters 20 Electron volts = 0 Newton meters 5000 Electron volts = 0 Newton meters 3 Electron volts = 0 Newton meters 30 Electron volts = 0 Newton meters 10000 Electron volts = 0 Newton meters 4 Electron volts = 0 Newton meters 40 Electron volts = 0 Newton meters 25000 Electron volts = 0 Newton meters 5 Electron volts = 0 Newton meters 50 Electron volts = 0 Newton meters 50000 Electron volts = 0 Newton meters 6 Electron volts = 0 Newton meters 100 Electron volts = 0 Newton meters 100000 Electron volts = 0 Newton meters 7 Electron volts = 0 Newton meters 250 Electron volts = 0 Newton meters 250000 Electron volts = 0 Newton meters 8 Electron volts = 0 Newton meters 500 Electron volts = 0 Newton meters 500000 Electron volts = 0 Newton meters 9 Electron volts = 0 Newton meters 1000 Electron volts = 0 Newton meters 1000000 Electron volts = 0 Newton meters Embed this unit converter in your page or blog, by copying the following HTML code:Comments
Electron-downloadDownloads an Electron release zip from GitHub.Used by electron-prebuilt and electron-packagerUsageNote: Requires Node >= 4.0 to run.$ npm install --global electron-download$ electron-download --version=0.31.1const download = require('electron-download')download({ version: '0.25.1', arch: 'ia32', platform: 'win32', cache: './zips'}, function (err, zipPath) { // zipPath will be the path of the zip that it downloaded. // If the zip was already cached it will skip // downloading and call the cb with the cached zip path. // If it wasn't cached it will download the zip and save // it in the cache path.})If you don't specify arch or platform args it will use the built-in os module to get the values from the current OS. Specifying version is mandatory. If there is a SHASUMS256.txt file available for the version, the file downloaded will be validated against its checksum to ensure that it was downloaded without errors.You can also use electron-download to download the chromedriver, ffmpeg,mksnapshot, and symbols assets for a specific Electron release. This can beconfigured by setting the chromedriver, ffmpeg, mksnapshot, orsymbols property to true in the specified options object. Only one ofthese options may be specified per download call.You can force a re-download of the asset and the SHASUM file by setting theforce option to true.If you would like to override the mirror location, three options are available. The mirror URL is composed as url = ELECTRON_MIRROR + ELECTRON_CUSTOM_DIR + '/' + ELECTRON_CUSTOM_FILENAME.You can set the ELECTRON_MIRROR or NPM_CONFIG_ELECTRON_MIRROR environment variable or mirror opt variable to use a custom base URL for grabbing Electron zips. The same pattern applies to ELECTRON_CUSTOM_DIR and ELECTRON_CUSTOM_FILENAME:## Electron Mirror of ChinaELECTRON_MIRROR=" or for a local mirrorELECTRON_MIRROR=" can set ELECTRON_MIRROR in .npmrc as well, using the lowercase name:electron_mirror= locationThe location of the cache depends on the operating system, the defaults are:Linux: $XDG_CACHE_HOME or ~/.cache/electron/MacOS: ~/Library/Caches/electron/Windows: $LOCALAPPDATA/electron/Cache or
2025-04-20@tomjs/electron-devtools-installer English | 中文Install Chrome extension for Electron, support cjs/esm.This library is based on Samuel Attard's electron-devtools-installer and JonLuca De Caro's electron-extension-installer, with some modifications and added small features. It provides support for esm and cjs to support for Electron v28+.For Chrome DevTools installation, please visit the Official Documentation.FeaturesSupport cjs/esmSupport Electron v28+ to use esmInstall# pnpmpnpm add @tomjs/electron-devtools-installer# yarnyarn add @tomjs/electron-devtools-installer# npmnpm add @tomjs/electron-devtools-installerUsageesm { installExtension(VUEJS_DEVTOOLS) // equals to installExtension("nhdogjmejiglipccpnnnanhbledajbpd") .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});">import { app } from 'electron';import { installExtension, VUEJS_DEVTOOLS } from '@tomjs/electron-devtools-installer';// Install Vue.js DevToolsapp.whenReady().then(() => { installExtension(VUEJS_DEVTOOLS) // equals to installExtension("nhdogjmejiglipccpnnnanhbledajbpd") .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});cjs { installExtension(VUEJS_DEVTOOLS) .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});">const { app } = require('electron');const { installExtension, VUEJS_DEVTOOLS } = require('@tomjs/electron-devtools-installer');// Install Vue.js DevToolsapp.whenReady().then(() => { installExtension(VUEJS_DEVTOOLS) .then(ext => console.log(`Added Extension: ${ext.name}`)) .catch(err => console.log('An error occurred: ', err));});DocumentationAPI Document provided by jsdocs.io.index.d.ts provided by unpkg.com.APIPreset Chrome Extensions IDThe following is a list of preset Chrome extensions ID:IDNameANGULAR_DEVTOOLSAngular DevToolsAPOLLO_CLIENT_TOOLSApollo Client DevtoolsBACKBONE_DEBUGGERBackbone DebuggerEMBER_INSPECTOREmber InspectorJQUERY_DEBUGGERjQuery DebuggerMOBX_DEVTOOLSMobX DevToolsPREACT_DEVELOPER_TOOLSPreact Developer ToolsREACT_DEVELOPER_TOOLSReact Developer ToolsREDUX_DEVTOOLSRedux DevToolsVUEJS_DEVTOOLSVue.js DevToolsVUEJS_DEVTOOLS_BETAVue.js devtools (beta)VUEJS_DEVTOOLS_V5Vue.js devtools (v5)VUEJS_DEVTOOLS_V6Vue.js devtools (v6)installExtension(extensionIds[, options])install chrome extension for electronextensionIds: string | string[] - Chrome extension idoptions: Install extension optionsloadExtensionOptions: session.LoadExtensionOptionsforceDownload: boolean - Force to download the extension even if it's already installed, default is falsesource: 'chrome' | 'unpkg' | 'jsdelivr' | 'npmmirror' - Download url source. When the OS language is zh_CN , the default value is npmmirror, otherwise it is chrome.session: 'string' | 'Electron.Session' - The target session on which the extension shall be installed, default is session.defaultSession.Returns Promise - extension name/version, etc.downloadExtension(extensionId[, options])download chrome extension for electronextensionId: string - Chrome extension idoptions: Download extension optionsforce: boolean - Force to download the extension even if it's already installed, default is falseunzip: boolean - Whether to unzip the downloaded file, default is trueattempts: number - Number of attempts to download the extension, default is 5outPath: string - The path to save the downloaded extension, default is path.join(app.getPath('userData'), 'extensions')source: 'chrome' | 'unpkg' | 'jsdelivr' | 'npmmirror' - Download url
2025-03-31首页 / 前端技术文章 / npm 包 electron-download-manager 使用教程 npm 包 electron-download-manager 使用教程 2021-02-08 18:50 阅读时长 6 分钟读完 介绍electron-download-manager 是一个用于 Electron 应用程序的下载管理器,可以方便地进行下载操作。它包含下载队列、下载速度控制、断点续传等功能,使用起来非常方便。安装使用 npm 进行安装:npm install electron-download-manager --save基本使用在你的 Electron 主进程中,你需要将 electron-download-manager 引用进来,然后使用以下代码创建一个下载:const { download } = require('electron-download-manager');const url = ' url);其中 BrowserWindow.getFocusedWindow() 是 electron 的一个内置方法,用于获取当前活动的窗口实例。你也可以使用其他方法获取窗口实例。然后,在你的渲染进程中,你可以监听下载事件:const { ipcRenderer } = require('electron');ipcRenderer.on('download complete', (event, item) => { console.log(item);});在下载完成后,会在渲染进程中触发一个 download complete 事件,我们可以通过监听这个事件获取下载完成的文件信息。高级用法设定下载路径你可以设定下载的路径,让它下载到你指定的文件夹中。只需要修改上面的代码:const { download } = require('electron-download-manager');const url = ' options = { directory: '~/Downloads'};download(BrowserWindow.getFocusedWindow(), url, options);其中 options 对象包含一个 directory 属性,可以指定下载的目录,这里我们设为桌面上的 Downloads 文件夹。多个下载进程你可以同时进行多个下载,只需要为每个下载设置不同的 id 即可:-- -------------------- ---- ------------ - -------- - - ------------------------------------------ ---- - ---------------------------------------- ---- - ---------------------------------------- ------- - - ---------- -------------------- ----- - ------------------------------------------ ----- -------------- ----- - ------------------------------------------ ----- ---------这里我们创建了两个下载,每个下载都有一个不同的 id。事件回调你可以监听下载事件的回调函数,以便在下载完成后进行一些操作:-- -------------------- ---- ------------ - -------- - - ------------------------------------------ --- - --------------------------------------- ------- - - ---------- -------------------- ---- - ------------------------------------------ ---- ------------------------ ------- ------ -- - --------------------- -- ------- ----------这里我们监听了 done 事件,当下载完成后就会触发这个事件,并在控制台中打印状态信息。断点续传通过下载管理器,我们可以轻松地进行断点续传操作,确保下载过程中出现错误时不会浪费我们已经下载的数据。-- -------------------- ---- ------------ - -------- - - ------------------------------------------ --- - --------------------------------------- ------- - - ---------- -------------- ------- ----------- ---- - ------------------------------------------ ---- -------------------------- ------- ------ -- - --------------------- -- ------------- ----------------------------- ------- ------ -- - --------------------- -- -- ------------- ----------这里我们为下载操作添加了一个 resume 属性,它设定为 true 后,就可以进行断点续传操作了。同时,我们还监听了 resume 和 progress 两个事件,用于响应断点续传操作和下载进度。示例代码以下是一个完整的示例代码,用于下载一个文件并在下载完成后打印其状态信息。你可以在自己的 Electron 应用程序中使用这个代码。-- -------------------- ---- ------------ - -------- - - ------------------------------------------ - ----------- - - ------------------------- --- - --------------------------------------- ------- - - ---------- -------------- ------- ----------- ---- - ------------------------------------------ ---- -------------------------- ------- ------ -- - --------------------- -- ------------- ----------------------------- ------- ------ -- - --------------------- -- -- ------------- ------------------------- ------- ------ -- - --------------------- -- ------- ------- -------------------------- ---------- ---------------------------------- ---------- ------- ----- -- - ---------------------结论electron-download-manager 是一个非常方便的下载管理器,在 Electron 应用程序中使用它可以轻松处理下载操作,并可以进行断点续传等高级操作。在开发 Electron 应用程序时,使用它可以大大提高开发效率,你们可以尝试使用它来进行开发。来源:JavaScript中文网 ,转载请注明来源
2025-04-06