evshiron 5d7c947411 chore(nsis-compat-updater): 1.2.0 7 年之前
..
src 0719638740 fix(nsis-compat-updater): fix misuse of dirname path 7 年之前
.npmignore d4690f64b2 refactor(project): some minor fixes 8 年之前
README.md db359ab028 feat(nsis-compat-updater): expose download progress event 8 年之前
package.json 5d7c947411 chore(nsis-compat-updater): 1.2.0 7 年之前
tsconfig.json 8451f55be6 feat(nsis-compat-updater): initialize 8 年之前
tslint.json 8451f55be6 feat(nsis-compat-updater): initialize 8 年之前
webpack.config.js c3945bbccd feat(nsis-compat-updater): employ webpack to reduce file sizes 8 年之前

README.md

nsis-compat-updater

nsis-compat-updater is an auto updater implementation for NW.js, inspired by electron-updater.

API

Imports

import { NsisCompatUpdater } from 'nsis-compat-updater';
// Or
// const { NsisCompatUpdater } = require('nsis-compat-updater');

Types


interface IInstaller {
    arch: string;
    path: string;
    hash: string;
    created: number;
}

interface IUpdater {
    arch: string;
    fromVersion: string;
    path: string;
    hash: string;
    created: number;
}

interface IVersion {
    version: string;
    changelog: string;
    source: string;
    installers: IInstaller[];
    updaters: IUpdater[];
}

interface IStreamProgress {
    percentage: number;
    transferred: number;
    length: number;
    remaining: number;
    eta: number;
    runtime: number;
    delta: number;
    speed: number;
}

new NsisCompatUpdater(feed: string, version: string, arch: 'x86' | 'x64')

const updater = new NsisCompatUpdater(feed, version, arch);

updater.onDownloadProgress.subscribe((state: IStreamProgress) => void)

updater.onDownloadProgress.unsubscribe((state: IStreamProgress) => void)

updater.checkForUpdates(): Promise<IVersion | null>

Returns an instance of IVersion if new version is available, otherwise null.

updater.downloadUpdate(version: string): Promise<string>

Returns the temporary path of the downloaded update.

updater.quitAndInstall(path: string)

updater.installWhenQuit(path: string)