I am currently creating a program that will be exported with NW.js.
Thus, it will be an executable (nw.exe) that I'll pack into a setup program.
The program will receive regular updates.
To deliver those updates to people successfully, I want a layout in my program that does the downloading of the update file (in .exe format). The user only needs to execute the file.
The only possible solution I could think of, is to use AJAX to download it and NW.js to write the file with the content "AJAX.LastData" to the AppFolder.
I think, I understand how to use AJAX and NW.js, but I can't seem to get it to work properly.
My problem is the following:
The download starts, the event "On progress" triggers as well, but when "On completed" triggers and I write the file with the content "AJAX.LastData" to the UserFolder, the .exe file is always double the size it should be and gives me the error "The version of this file is not compatible with the currently executed version of Windows [...]" .
(The original file, before uploading and downloading though, works fine)
Also, when downloading the file normally through a browser, the downloaded file works perfectly.
I also already tried to override the MIME type in AJAX to "application/octet-stream" which resulted in the exact same file.
Is there any way to fix this?
Or is it a thing that downloading large/.exe files with AJAX doesn't work in general?
If so, is there an alternative apart from giving the user a simple download link to insert in the browser?
Any help is much appreciated.
Thanks for reading.