Integrating DBLSQD with Node.js/JavaScript
You can use DBLSQD to add auto-update functionality to any Node.js application.
This document shows you how to build your own auto-update
workflow in Node.js with the DBLSQD SDK.
If you want to use DBLSQD in the context of an Electron app, check out the
documentation of our drop-in
Electron auto-update UI.
Adding the SDK to Your Project
You can add the DBLSQD SDK to your application with
npm install --save dblsqd-sdk
or by
adding it to the dependencies in your
package.json
.
The DBLSQD Node.js SDK provides a simple Promise-based API for retrieving update information from a feed and downloading releases.
Get the Node.js DBLSQD SDK from npm Full JSDoc Documentation
Using the SDK
Here is an example of how to use the SDK:
const {Feed} = require("dblsqd-sdk")
let feed = new Feed("https://feeds.dblsqd.com/:app_token", ":channel", ":os", ":arch")
feed.load().then(() => {
//Get all available releases
const releases = feed.getReleases()
//Only get updates to the current version
const {version} = require("./package.json")
const updates = feed.getUpdates(version)
//Download an update
if (updates.length > 0) {
feed.downloadRelease(updates[0].version).then(file => {
console.log(`The update was successfully downloaded to ${file}`)
})
}
})