-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-streamed downloads #14591
base: 3.x
Are you sure you want to change the base?
Support non-streamed downloads #14591
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please can you remove the part that saves new files to the disk? I am conscious we are already writing a lot of this data to the disk and XLSX files are already generated ahead of time, so we can probably avoid that for now while still allowing non-streamed downloads.
Please be aware that you may hit the memory limit more often if you don't stream
I would also double check that Vapor definitely doesnt support streamed downloads, because that doesn't really sound right to me 🤔
To get things working on Vapor, you need to add the I only use the XLSX downloader so I've simply subclassed public function __invoke(Export $export): StreamedResponse
{
return tap(parent::__invoke($export), function (StreamedResponse $response) {
$response->headers->set('X-Vapor-Base64-Encode', true);
});
} $this->app->bind(BaseXlsxDownloader::class, XlsxDownloader::class); |
Is there a way we can detect Vapor within Filament and do this on the users behalf? Instead of disabling streaming? |
For Vapor: Will try to reshape this PR a bit with the given feedback. I'm afraid for Bref downloads larger than 6MB should come from a disk (s3), see: https://bref.sh/docs/use-cases/http/binary-requests-responses
|
Description
Some hosting environments do not support streamed downloads (mainly environments running on lambda like Laravel Vapor or Bref). This makes the export functionality not work because the downloaders assume we can do a streamed download.
This PR adds a config to enable/disable streamed downloads. When disabled, the downloader will write the contents to one file and uploads it to the disk (so we don't have to re-do the generation on multiple downloads).
Visual changes
N/A
Functional changes
composer cs
command.