Gathering detailed insights and metrics for electron-tiny-updater
Gathering detailed insights and metrics for electron-tiny-updater
Gathering detailed insights and metrics for electron-tiny-updater
Gathering detailed insights and metrics for electron-tiny-updater
npm install electron-tiny-updater
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
3 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jun 20, 2020
Latest Version
1.0.1
Package Id
electron-tiny-updater@1.0.1
Unpacked Size
10.96 kB
Size
4.02 kB
File Count
7
NPM Version
6.13.7
Node Version
13.11.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
一个极精简版本的electron应用更新器,依赖electron-builder打包的结果,支持mac和windows
没有electron-updater的诸多校验和判断逻辑,只是单纯的下载和执行安装包,如果你用NSIS处理打包结果,比如添加一些注册表操作等,你就通不过electron-updater的sha校验,或者你手动生成一个sha值填到latest.yml中
或者如果你使用零配置的electron-builder,不生成latest.yml这些文件,也可以使用electron-tiny-updater
npm i electron-tiny-updater
在你的electron应用主进程中添加如下代码
const {tinyUpdater} = require('electron-tiny-updater');
const path = require('path');
const emitter = tinyUpdater({
currentVersion: '1.0.2', // 当前应用的版本号,可以通过package.json来引入
configType: 'yml', // 配置文件类型,支持yml和json格式两种
configUrl: 'https://xxx.com/latest.yml', // 配置文件的url
configFilename: 'latest.yml', // 配置文件名
pkgFilename: 'app.exe', // 安装包名称
filePath: path.join(__dirname, '../..') // 文件保存的路径
});
// 第一个参数total表示安装包的总大小,第二个参数length表示当前已下载的大小
emitter.on('download-progress', (total, length)=>{
console.log(total, length, 'progress')
});
emitter.on('error', (e)=>{
console.log(e, 'error')
});
参数configType支持填写yml和json两个值,如果使用electron-builder打包,配置了publish选项的话,会得到一个latest.yml,里面会包含安装包的版本信息,一个windows版本的latest.yml文件示例如下,可能需要手动修改url路径和files的顺序(windows下第一个文件放exe,mac下第一个文件放dmg),electron-tiny-updater会下载files中的第一个文件信息
version: 2.1.2
files:
- url: http://xxx/app_2.1.2.exe
sha512: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
size: 59388528
- url: http://xxx/app_2.1.2.zip
sha512: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
size: 19388528
path: app_2.1.2.exe
sha512: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
releaseDate: '2020-06-17T03:52:46.882Z'
如果没有配置publish选项,可以手动提供一个json或者yml格式的配置文件,一个json格式的配置文件示例如下,只提供版本信息和安装包的url就足够了
{
"version": "2.1.2",
"url": "http://xxx/app_2.1.2.exe"
}
将配置文件上传到服务器或者CDN,然后将url地址填入configUrl参数,electron-tiny-updater会下载并解析配置文件,获取版本信息,并和currentVersion参数做对比,如果配置文件里的版本更高,会下载安装包,安装包也需要先上传,electron-tiny-updater会下载并提供download-progress
事件以展示下载进度
filePath、pkgFilename、configFilename用于下载文件后的文件保存,配置文件会保存在path.join(filePath, configFilename)
路径,安装包会保存在path.join(filePath, pkgFilename)
,因为没有合适的时机删除已下载的文件,建议给pkgFilename和configFilename一个固定值,每次更新都只会留下这两个文件,不会累积安装包文件
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/3 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
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
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
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