Download large file and save it to the disk

Get help using Construct 2

Post » Sat Jan 28, 2017 9:19 pm

Aye everyone,

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.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sat Mar 18, 2017 9:18 pm

I'm sorry if I was not particular enough, if you got any questions, I'll happily provide the answers for you.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Sun Mar 19, 2017 12:41 am

Any reason why "invoke download" in the browser object won't work for you?

There may be security issues preventing you from writing executable files directly to someone's drive through nw.js
Mistakes were made.
B
53
S
27
G
114
Posts: 1,699
Reputation: 64,446

Post » Sun Mar 19, 2017 5:45 pm

The browser action won't work for me, since I want to download the file(s) internally, without opening a browser / another window.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests