[QUESTION] Stream resource in response
- Dominant language
- PHP
- Stars
- 6.9k
- Forks
- 1.3k
- Avg merge
- 4h 21m
- Merged PRs (30d)
- 4
Description
I'm using flysystem Filesystem to handle storage of large files.
I need to stream large file to user.
I need to use $resource = $filesystem->readStream($path); to be able to reduce at minimum the memory usage.
$resource is a "file read resource" that can be used to send chunked data in response.
At the moment $response->withBody() method need a string and classes SwooleFileStream accept a string file path.
It will be perfect to have a SwooleResouceStream to stream in a chunked way a large file using a generic resource object
I saw a $response->download() method but also this method would like a local file path and cannot use a resource.
Before starting implementing my own SwooleResouceStream does anybody has a better solution or suggestions?
Contributor guide
Assessment
This issue has not been assessed yet.