13
Views
2
Comments
Solved
Problem with download widget in Reactive web app, slow if file size is big
Application Type
Reactive

I am using download widget to download a file from server in reactive web app.

1. I have created a client action.

2. Created a server action.

3. Client action calls server action, server action get file and returns it's binary to client action, client action gives that file to user using "download widget"


Problem:

As per my understanding, server action gives complete file in binary format to client action and client action give that file to user via download widget.

Now what if file size is 1 GB, in this case it is taking too much time to get server action response as it is giving full file to client.


So is there any way that we can download or give file to user directly from Server action.

I.e. download from URL


I can see that in web application, we can give user to a download URL, or from any action we can initiate the download URL action , now file come directly to browser and it free the hold of web application, now user can see  download progress from 0-100% and also simultaneously work on web application.

Explained in "ExpectedDownload.jpg" file.


is there any way, we can achieve something similar in  OutSystems ?





ExpectedDownload.jpg

Staff
Rank: #20
Solution

Hi Ankit,

Indeed reactive and traditional are different, reactive gives you more versatility (e.g. you could post-process the file with js on the client side), but it does not work so well for larger files.

To achieve the same behavior as in traditional web you can create a rest endpoint for your files and redirect to it with an external site. You might need to use the httprequesthandler extension in that rest endpoint to set the content type. Be aware that rest endpoints will not have authentication by default, so you might want to create a temporary token in the database for this, and send it to the rest endpoint as a parameter where it should be validated.

Cheers,

Tiago Simões 

Staff
Rank: #20
Solution

Just one more thing: if you are expecting 1Gb files an even better option would be to use an external service like AWS S3.

Cheers,

Tiago Simões

Staff
Rank: #20
Solution

Hi Ankit,

Indeed reactive and traditional are different, reactive gives you more versatility (e.g. you could post-process the file with js on the client side), but it does not work so well for larger files.

To achieve the same behavior as in traditional web you can create a rest endpoint for your files and redirect to it with an external site. You might need to use the httprequesthandler extension in that rest endpoint to set the content type. Be aware that rest endpoints will not have authentication by default, so you might want to create a temporary token in the database for this, and send it to the rest endpoint as a parameter where it should be validated.

Cheers,

Tiago Simões 

Staff
Rank: #20
Solution

Just one more thing: if you are expecting 1Gb files an even better option would be to use an external service like AWS S3.

Cheers,

Tiago Simões