Skip to content

Download game with electron / detect game version with electron

I have to build a game launcher with electron. I have two questions:

  • Which way to download file from client (angularjs)? ftp? http?
  • how can I detect the game version to update it?


With electron you can use all the APIs Node.js have additional to the APIs Chrome have. So you can Download the game useing ftp or http like you would do in Node.js or use Ajax ($http). For saveing you can use the normal file system, and for the version you can use the filesystem or localstorage. Here is a snippet to save the game:

const http = require('http');
const fs   = require('fs');
const app  = require('remote').require('app');
var file = fs.createWriteStream(app.getDataPath() + "externalFiles/");
var request = http.get("", response => {

on the server you can simply have a request returning the version or the hash of the latest version, and if that changes it will download the game again.