Answer the question
In order to leave comments, you need to log in
How to limit the rate of response->stream?
I use this option
set_time_limit(0);
/** @var \League\Flysystem\Filesystem $fs */
$fs = Storage::disk('files')->getDriver();
$metaData = $fs->getMetadata($file->fullroute);
$stream = $fs->readStream($file->fullroute);
if (ob_get_level()) ob_end_clean();
return response()->stream(
function () use ($stream) {
fpassthru($stream);
},
200,
[
'Cache-Control' => 'private',
'Content-Type' => $file->type,
'Content-Length' => $file->size,
'Content-Disposition' => 'attachment; filename="' . $file->filename . '"',
'Pragma' => 'public',
]);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question