Oneclick Update

NPM version js-standard-style


Simple installer downloads and update server

What it does

Serves updates and installers following the common Squirrel + Electron pattern via Github releases.

In addition to the standard fare of these types of libraries it adds the ability to serve different release channels based on semver build metadata.

1.0.0+channelName -> /download/channelName/win32

It similarly handles prerelease channels, even prereleases on alternate channels.

2.0.0-1 -> /download/prerelease/win32

2.0.0-1+channelName -> /download/channelName/prerelease/win32

Why use this over hazel, nuts, etc…

Both nuts and hazel are excellent libraries. That being said, here are some of the reasons you might use this instead.


Just running as a server, use any of these options to download the script. It’s standalone.

If you’re using it as a module, you know the drill.

npm i -s oneclick-update


Just running as a server, couldn’t be simpler.

curl -o oneclick.js
SET GITHUB_REPO=doesdev/oneclick-release-test
node oneclick.js

Using a private repo, also simple.

curl -o oneclick.js
curl -o secrets.json
# modify the secrets.json file with your Github oauth token, repo, port, and return URL
node oneclick.js

Environment variables


Detect platform via user-agent and download latest installer

Download latest installer for specified platform

Get update JSON for specified version, if version matches latest returns no content

Get RELEASES file with nupkg download info (Windows only)


const { requestHandler, on } = require('oneclick-update')
const config = {
  repo: 'doesdev/oneclick-release-test',
  port: 8082,
  token: 'yourGithubOauthToken',
  serverUrl: '',
  refreshCache: '15 mins',
  logDownloads: false,
  platformFilters: { /* see Platforms below for details */ },
  hostToChannel: {
      The `hostToChannel` option allows you to treat the hostname as a channel.
      That means you can have `` handle the primary channel
      and `` handle the `otherhost` channel
    '': {
      name: 'otherhost',
      serverUrl: ''

const startServer = async () => {
  const handler = await requestHandler(config)
  createServer(handler).listen(config.port, () => {
    console.log(`Update server running on port ${config.port}`)

on('download', ({ ip, requestUrl, asset, channel, platform, version }) => {
  console.log(`User at ${ip} downloaded ${asset}`)



Natively supports Windows, OSX and Linux.

Currently arch specification is not fully implemented. That being said you can create your own platform extensions that filter assets as you desire. The intent is to support arch specification natively, but in the interim it could be implemented something like this (assuming you’ve named Windows x64 assets with win64 in the name).

const config = {
  platformFilters: {
    win64: (assets, action) => {
      return assets.find((a) =>'win64') !== -1)

Similarly you can define any custom platform filtering that you would like. The expectation is the key is what would be specified in the platform part of the URL and the value is a function that filters the assets to the one you would like to use.

The signature of the filtering function is (assets, action, arch, extension)


MIT © Andrew Carpenter