Log message #4200095

# At Username Text
# Aug 28th 2019, 07:29 spriz but we also mostly handle batches of ~2-3 mb JPEGs and rather large dat/csv/txt files (50-100mb)
# Aug 28th 2019, 07:28 spriz I see - I thought actually streams always would more or less outperform strings in memory
# Aug 28th 2019, 07:27 spriz but that might be more of a PHP thing than a Cake thing anyway :slightly_smiling_face:
# Aug 28th 2019, 07:27 admad unless your file is very large not using streaming is more efficient i believe
# Aug 28th 2019, 07:26 spriz or `stream_get_contents()` for the matter
# Aug 28th 2019, 07:26 spriz I'm just thinking of poor newcomers to which the whole `stream` thing might be new. I see a lot of `file_get_contents` around still
# Aug 28th 2019, 07:25 spriz True, that's perfect for me as well :)
# Aug 28th 2019, 07:25 admad `$response->withBody(new Stream($fileStream))` is easy enough
# Aug 28th 2019, 07:24 spriz I guess there is some overhead of converting a `resource` to `StreamInterface` so it would be better if one could keep things in `StreamInterface` from the start - maybe that's the reasoning?
# Aug 28th 2019, 07:23 spriz Oh yeah, I remember expecting that initially
# Aug 28th 2019, 07:22 admad `withBody()` could have had a wider argument type which converted a resource instance into StreamInterface instance :P
# Aug 28th 2019, 07:19 spriz so I'll forgive you on that one ;P
# Aug 28th 2019, 07:19 spriz I was looking for `withStream` by reflex anyway :)
# Aug 28th 2019, 07:19 admad i had a n00b moment, Response doesn't have any `set*` method (expect deprecated ones maybe)
# Aug 28th 2019, 07:18 spriz grrrrrrrrreat
# Aug 28th 2019, 07:18 spriz No worries, this is much better! And it also keeps memory usage down
# Aug 28th 2019, 07:17 admad sorry, no such method :P
# Aug 28th 2019, 07:17 spriz or did I misunderstand?
# Aug 28th 2019, 07:17 spriz I don't see such method @admad: https://api.cakephp.org/3.8/class-Cake.Http.Response.html
# Aug 28th 2019, 07:16 admad or maybe just `$response->setStream($fileStream)` might work
# Aug 28th 2019, 07:16 spriz Thanks a lot, that has been bugging me... Facepalm ,:)
# Aug 28th 2019, 07:15 spriz Works @admad!
# Aug 28th 2019, 07:15 spriz will try right awya
# Aug 28th 2019, 07:15 spriz Aha! Of course
# Aug 28th 2019, 07:15 admad just avoiding the use of CallbackStream
# Aug 28th 2019, 07:14 admad so you can try passing your `$fileStream` to it
# Aug 28th 2019, 07:14 admad @spriz Zend\Diactoros\Stream does take a stream as constructor argument.
# Aug 28th 2019, 07:11 admad np
# Aug 28th 2019, 07:11 javier.villanueva yes, sorry
# Aug 28th 2019, 07:10 admad @javier.villanueva welcome, in future please use one of the help forums first before opening a GH issue for support :slightly_smiling_face:
# Aug 28th 2019, 07:03 javier.villanueva @admad you were right. I disable adminlte and works. thanks a lot
# Aug 28th 2019, 07:02 alexdd55976 morning fellaws
# Aug 28th 2019, 07:00 spriz This is how I usually do this: https://gist.github.com/Spriz/a3ac5789283454373436cb979539fa94. Any chance I can avoid the `new CallbackStream`? :thinking_face:
# Aug 28th 2019, 06:59 spriz What is your preferred way to serve file downloads (this case CSV) to users? They are on S3 currently - isn't reading the file as stream and serving that the most efficient? :slightly_smiling_face:
# Aug 28th 2019, 06:51 javier.villanueva ok
# Aug 28th 2019, 06:50 admad the problem is with your setup not the plugin
# Aug 28th 2019, 06:50 javier.villanueva perfect
# Aug 28th 2019, 06:50 admad please close the issue you opened on GH :slightly_smiling_face:
# Aug 28th 2019, 06:49 javier.villanueva ok, i will research in this way. Thanks admad
# Aug 28th 2019, 06:49 admad maybe by the adminlte plugin you are using
# Aug 28th 2019, 06:49 admad these `'CsvView.Csv'` view class you set it getting reset,