Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
electron-github-asar-updater
Advanced tools
This package works after Electron app is packaged.
electron-github-asar-updater v2.x require Electron version >= 2.0.0
Default
// Electron main process
const Updater = require('electron-github-asar-updater')
/**
* Write file
* ${process.resourcesPath}/updater/index.js
* ${process.resourcesPath}/updater/package.json
*/
const updater = new Updater('githubUser/repoName', '{{prefix}}');
(async function () {
/**
* Check latest github release.
*
* Tag name must be "vX.X.X".
* For example: v2.3.3
*
* Asar zip name must be `{{prefix}}-${process.platform}-${process.arch}.zip`
* For example: {{prefix}}-win32-ia32.zip {{prefix}}-linux-x64.zip
*
* Full asset name example:
* myapp-v2.3.3-win32-x64.zip
* myapp-v2.3.3-win32-ia32.exe
* myapp-v2.3.3-linux-x64.deb
*/
await updater.check({
/**
* -1: ignore pre-release (default)
* 0: include pre-release
* 1: check prerelease only
*/
prerelease: -1
})
const info = updater.getUpdateInfo()
if (info) { // newer version found
console.log(info)
if (updater.isReadyToDownload()) { // exists `resources-${process.platform}-${process.arch}.zip`
/**
* Download `resources-${process.platform}.zip` and unzip to
* `${process.resourcesPath}/.patch`
*/
const downloadResult = await updater.download(({ name, current, max, loading }) => {
/**
* {
* name: string;
* current: number;
* max: number;
* loading: number;
* }
*
* do something, return void
*/
})
if (downloadResult) { // Success
/**
* 1. Rename `${process.resourcesPath}/updater` to `${process.resourcesPath}/app`
* 2. Relaunch. Copy `${process.resourcesPath}/.patch/*` to `${process.resourcesPath}`
* 3. Remove `${process.resourcesPath}/.patch`
* 4. Rename `${process.resourcesPath}/app` to `${process.resourcesPath}/updater`
* 5. Relaunch
*/
updater.relaunch()
} else {
console.log('download aborted.')
}
}
}
})()
Use custom updater executable
// Electron main process
const Updater = require('electron-github-asar-updater')
// use custom updater executable
const updater = new Updater('githubUser/repoName', '{{prefix}}', true);
(async function () {
await updater.check({
prerelease: -1
})
const info = updater.getUpdateInfo()
if (info) {
if (updater.isReadyToDownload()) {
const downloadResult = await updater.download(({ name, current, max, loading }) => {})
if (downloadResult) {
// run executable and exit app, relaunch app by your program
require('child_process').spawn(/* ... */).unref()
updater.relaunch() // just call app.exit()
} else {
console.log('download aborted.')
}
}
}
})()
FAQs
electron asar updater
The npm package electron-github-asar-updater receives a total of 2 weekly downloads. As such, electron-github-asar-updater popularity was classified as not popular.
We found that electron-github-asar-updater demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.