I’m looking for something like io.Reader in Go. I would like to do a HTTP request and expose the result as a stream where other parts of the application can consume it as it. What can I use in Elixir for that?
I think you’d use Stream.unfold/2
to build a Stream on top of your HTTP client-specific functions (e.g. HTTPoison.stream_next/1
).
From my limited understanding of io.Reader
it’s closer to what an io device is on the beam rather than a stream, though this shouldn’t mean that it’s the correct tool to use for here.