Iterating over a file stream

But then you have additional overhead for getting those chunks in the correct order again.

As you need the lines in the correct order after the operation, a single file |> Stream.map(your_fun) |> Stream.map(fun line -> IO.write(dest_file, line) end) |> Stream.run should be enough and do the job.

3 Likes