StreamHttpResponse in Nette

6 years ago

brano
Member | 25
+
0
-

Hi,

Im sending big generated files in response (e.g. CSV with milions of rows, stream a sound or video), and I would like to start sending the output before it is all generated in PHP (e.g. from iterator in DB). Did anyone try to solve this in Nette? I would prefer to check first before inventing own response class, Google was not helpfull yet. I think there is something like what Im looking for in Django (StreamHttpResponse).

\Brano

Last edited by brano (2014-04-10 11:53)

6 years ago

Filip Procházka
Moderator | 4693
+
0
-

You might wanna create custom implementation of Nette\Application\IResponse, not Nette\Http\IResponse. It should accept the model and dump the data in some iteration and flush each time the output to browser.