reactphp / stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP.
https://reactphp.org/stream/
MIT License
618 stars 62 forks source link

ReadableStreamInterface to PSR-7 StreamInterface. #141

Closed bartvanhoutte closed 5 years ago

bartvanhoutte commented 5 years ago

What is the best way to go from React\Stream\ReadableStreamInterface to Psr\Http\Message\StreamInterface\?

I found https://github.com/WyriHaximus/reactphp-psr7-stream-converter, but it is archived.

Thanks for your help!

WyriHaximus commented 5 years ago

You can buffer the contents with and once you reached the end of it create the PSR-7 request/response: https://reactphp.org/promise-stream/#buffer

bartvanhoutte commented 5 years ago

Thank you👌