CollectableStreamer

This is a module for accessing System.cmd/3 output line by line.

CollectableStreamer implements the Collectable protocol, allowing you to stream the output of a command to a function. This is particularly useful for processing the output of long-running commands without having to wait for the entire output to be available.

Example Usage

streamer = CollectableStreamer.new(fn line -> IO.puts("Received line: #{line}") end)
System.cmd("rsync", ["-av", "foo@example.com:/source/", "/destination/"], into: streamer)

Installation

The package can be installed by adding collectable_streamer to your list of dependencies in mix.exs:

def deps do
  [
    {:collectable_streamer, "~> 0.1.0"}
  ]
end