Crate velopack

Source
Expand description

§Velopack

Velopack is a auto-update and installation framework for cross-platform desktop applications. With less than 10 lines of code, you can add auto-update and installation features to your application.

§Features

  • 😍 Zero config – Velopack takes your build output (eg. cargo build), and generates an installer, and updates and delta packages in a single command.
  • 🎯 Cross platform – Velopack supports building packages for Windows, OSX, and Linux. No matter your target, Velopack can create a release in just one command.
  • ⚡️ Lightning fast – Velopack is written in Rust for native performance. Creating releases is multi-threaded, and produces delta packages for ultra fast app updates. Applying update packages is highly optimised, and often can be done in the background.

§Documentation

The documentation in this rust crate is minimal and only covers the create itself, so it’s highly recommended that you also read the main Velopack documentation at https://docs.velopack.io.

§Components

  • this crate: The core library that provides auto-update features and glue to the other components.
  • vpk cli tool: The vpk command line tool packages and publishes your releases and installers.
  • update binary: Bundled with your application by vpk, handles

§Optional Rust Features

  • async: Enables async support using async-std.

§Quick Start

  1. Add Velopack to your Cargo.toml:
[dependencies]
velopack = { version = "0.0", features = ["async"] } # Replace with actual version and desired features
  1. Add the following code to your main() function:
use velopack::*;

fn main() {
    // VelopackApp should be the first thing to run, in some circumstances it may terminate/restart the process to perform tasks.
    VelopackApp::build().run();
    // Your other app startup code here
}
  1. Add auto-updates somewhere to your app:
use velopack::*;

fn update_my_app() {
    let source = sources::HttpSource::new("https://the.place/you-host/updates");
    let um = UpdateManager::new(source, None, None).unwrap();

    if let UpdateCheck::UpdateAvailable(updates) = um.check_for_updates().unwrap() {
        // there was an update available. Download it.
        um.download_updates(&updates, None).unwrap();

        // download completed, let's restart and update
        um.apply_updates_and_restart(&updates).unwrap();
    }
}
  1. Build your app with cargo:
cargo build --release
  1. Install the vpk command line tool:
dotnet tool update -g vpk

Note: you must have the .NET Core SDK 8 installed to use and update vpk

  1. Package your Velopack release / installers:
vpk pack -u MyAppUniqueId -v 1.0.0 -p /target/release -e myexename.exe

✅ You’re Done! Your app now has auto-updates and an installer. You can upload your release to your website, or use the vpk upload command to publish it to the destination of your choice.

Read the Velopack documentation at https://docs.velopack.io/ for more information.

Modules§

bundle
Utility functions for loading and working with Velopack bundles and manifests.
constants
Constant strings used internally by Velopack.
delta
Functions to patch files and reconstruct Velopack delta packages.
download
Utility function for downloading files with progress reporting.
locator
Locator provides some utility functions for locating the current app important paths (eg. path to packages, update binary, and so forth).
lockfile
Acquire and manage file-system based lock files.
sources
Sources contains abstractions for custom update sources (eg. url, local file, github releases, etc).

Structs§

UpdateInfo
Holds information about the current version and pending updates, such as how many there are, and access to release notes.
UpdateManager
Provides functionality for checking for updates, downloading updates, and applying updates to the current application.
UpdateOptions
Options to customise the behaviour of UpdateManager.
VelopackApp
VelopackApp helps you to handle app activation events correctly. This should be used as early as possible in your application startup code. (eg. the beginning of main() or wherever your entry point is)
VelopackAsset
An individual Velopack asset, could refer to an asset on-disk or in a remote package feed.
VelopackAssetFeed
A feed of Velopack assets, usually retrieved from a remote location.

Enums§

Error
NetworkError
UpdateCheck
Represents the result of a call to check for updates.