Closed AdyStudios closed 3 years ago
https://www.npmjs.com/package/extract-zip For extracting zip, I also dont want to directly google how to make auto updates, just for the chalange
Maybe this can help? https://www.npmjs.com/package/auto-git-update
As I understand it, that way, any commit that is made in the main repository, will be obtained automatically.
Well I don't maybe that could work, but first I want to try it on my own, but thanks for your help 👍
Should work now.
Looks good 😀, but I will try to add completely auto update, I think you can override app.js while its running bc its on the ram, but maybe not, if not we start the installer and just shut the tracker down.
Well, just overwriting the app.js might not be so optimal. What if we add new files to the tracker? The solution that we get the files from GitHub is also not the best. There, for example, the API key is not preserved. Getting a ZIP file is a solution but what do we do when we update or add dependencies? (not via npm packages)
So I think downloading the setup file is currently the best solution. Only you would have to find out if you have an event, so to speak, that is triggered when the download is complete. Currently the notification is sent after a timeout. This is not so optimal.
Yeah your right. Sad me :(
No problem. ;-) That's what the comment function is for. As I said, we just need to find out if there is some kind of event that is triggered when the download is complete.
This one is just happens to have one, it uses fs var http = require('http'); var fs = require('fs');
var download = function(url, dest, cb) { var file = fs.createWriteStream(dest); var request = http.get(url, function(response) { response.pipe(file); file.on('finish', function() { file.close(cb); // close() is async, call cb after close completes. }); }).on('error', function(err) { // Handle errors fs.unlink(dest); // Delete the file async. (But we don't check the result) if (cb) cb(err.message); }); };
That should help already.
Indeed, but I'm not home right now. I want to get home :((
Should be finalized with the last commit.
The way I imagine it that we just download a zip file from d1strict or directly from github, then we extract it and replace all the files.