4 weeks ago

File Download

Posted 4 weeks ago by streamingsystems


I am using Laravel 8.

I wanted to run some ideas by some fellow developers to make sure I am understanding the way the file download works in Laravel.

I am using Amazon S3 as my back end storage system and it's all connected and working fine in my system.

I am providing a button so my customers can download files (invoices, videos, etc).

Option 1: Download via Streams

When I use the stock "download" it looks like (based on the source) that it's using streams as discussed here:

I understand this such that when I initiate a download it will connect to Amazon s3 and then read the file in real-time and pass "through" my web server for the entire download. As the bits are read from amazon (private bucket authenticated via the Laravel/s3 connector) they are sent back to the user.

Is that correct? Or does it somehow download the file first to a temp file on my web server and then send that back?

I would think with a lot of downloads going concurrently this approach would take a lot of resources from my web server.

Option 2: Temp URL

The other option is to create a Temp URL from Amazon and essentially hand off the download to Amazon as discussed here:

This would, I would think, just take my web server resources as it's setting up the temp URL and handing it off.

Any replies or insight would be greatly appreciated.



Please sign in or create an account to participate in this conversation.