Http request iodata to string?

not sure if it matters but i have tesla, httpoison, and finch available. im requesting a .txt file and it appears to be coming back as iodata in the body. i want to parse that body to a string or, even better, Enum over it line by line like if i was using File.read!/1 to read the file locally. i can’t seem to figure it out. right now im left to saving the .txt file and then using File.read!/1.

I hope I’m not oversimplifying here, but you can call to_string/1 on iodata

iex(87)> to_string ['abc', [100], "e"]
"abcde"
1 Like

It’s trivial to convert to string but I’m curious why can’t you iterate on the file? Is the iodata why problematic sh as per e.g. recursive?

If it’s a normal charlist it should be easy to split it into lines and work on each one.

1 Like

thanks y’all! i ended up needing this bit :unicode.characters_to_binary(body, :latin1)