如何准备一个非常大的文件供用户使用Laravel下载?

Here is what I want to do :

  1. User purchases a big file (1GB)
  2. Download link is created with laravel's Signed URLs (link is valid for one day)
  3. User can download the file without seeing the actual URL

Here is the working code:

if (!request()->hasValidSignature()) {
            abort(404);
        }

$file = ProductFile::findOrFail($id);
return response()->download($file->path);

But the problem is it takes up all the server's RAM. Even my website does not load while downloading.

I searched around and I think there are two ways:

one: chunking the file and using response:stream(). I tried this, it's working but the download is not Resumable. How to make it resumable? I know I should use Accept-Ranges header But How to do it in laravel?

two: putting the file in a static download host and hide the actual URL. How?

Thank you very much