What is electron-updater?
The electron-updater npm package provides a way to automatically update Electron applications. It integrates with the Electron framework to enable seamless updates of desktop applications built with Electron. The package allows for easy distribution of updates by checking for new versions and downloading them in the background.
What are electron-updater's main functionalities?
Auto Update
This feature allows the application to automatically check for updates and notify the user when an update is available. It can also download and install the updates in the background.
const { autoUpdater } = require('electron-updater');
autoUpdater.checkForUpdatesAndNotify();
Update Events
This feature allows developers to listen for specific events during the update process, such as when an update is available or when it has been downloaded. Developers can then take appropriate actions, like prompting the user or automatically restarting the application.
const { autoUpdater } = require('electron-updater');
autoUpdater.on('update-available', (info) => {
console.log('Update available.');
});
autoUpdater.on('update-downloaded', (info) => {
console.log('Update downloaded; will install in 5 seconds');
setTimeout(() => {
autoUpdater.quitAndInstall();
}, 5000);
});
Manual Update Checks
This feature allows developers to manually trigger an update check instead of relying on automatic checks. This can be useful for giving users the option to check for updates on demand.
const { autoUpdater } = require('electron-updater');
autoUpdater.checkForUpdates();
Other packages similar to electron-updater
update-electron-app
A lightweight updater for Electron apps that works with GitHub Releases. It is simpler than electron-updater but does not provide as many configuration options or features such as differential updates.
nuts
A smart release server for Electron apps that uses GitHub as a backend for serving updates. It is not an npm package but a server that you can deploy. It provides similar functionality but requires more setup compared to electron-updater.
squirrel
Squirrel is a set of tools for installing and updating Windows and macOS applications. While not an npm package, it is often used in conjunction with Electron to provide update functionality. It is more complex and provides more control over the update process compared to electron-updater.
electron-updater
This module allows you to automatically update your application. You only need to install this module and write two lines of code!
To publish your updates you just need simple file hosting, it does not require a dedicated server.
See Auto Update for more information.
Supported OS:
- macOS (Squirrel.Mac).
- Windows (NSIS).
- Linux (AppImage, rpm, deb).
Credits
Thanks to Evolve Labs for donating the npm package name.