Download large file and save it to the disk

0 favourites
  • 4 posts
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm sorry if I was not particular enough, if you got any questions, I'll happily provide the answers for you.

  • 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

  • The browser action won't work for me, since I want to download the file(s) internally, without opening a browser / another window.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)