Welcome Guest, Not a member yet? Register   Sign In
StreamResponse class
#1

Now we don't have a way to handle stream response data.
So, for example, we can't write clean code for outputting CSV file directly from the database data
without loading all the records in the memory.

See the following articles:
https://makitweb.com/how-to-export-data-...igniter-4/
https://onlinewebtutorblog.com/codeignit...-tutorial/
Reply
#2

The concept of the framework is that we first collect all the data and then send it. The implementation of the StreamResponce class will need to follow the same concept.

It seems to me that it would be easier to modify ResponseTrait::download() to work with the resource.
Reply
#3

ResponseTrait::download() returns DownloadResponse.
The StreamResponse would be similar to the DownloadResponse.
Reply
#4

I’ve had a few occasions where I would have used this. I’m in favor.
Reply
#5

(This post was last modified: 08-08-2022, 12:07 AM by InsiteFX. Edit Reason: spelling error )

Likewise I'm in favor of it also.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

Me too ?
Reply
#7

If this would allow fpassthru() to work as expected: +1
Reply
#8

(07-25-2022, 11:33 PM)kenjis Wrote: ResponseTrait::download() returns DownloadResponse.
The StreamResponse would be similar to the DownloadResponse.
And what will be the fundamental difference between DownloadResponse and StreamResponse?

DowloadResponse is already outputting to the STDOUT stream.
Reply
#9

DowloadResponse is specialized for file downloads.
It requires a file to stream output.
See the sendBodyByFilePath() method.

For example, StreamResponse will be able to output a csv file from the database data
without creating a file and without getting all the data in memory.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB