Skip to content

Instantly share code, notes, and snippets.

@ivancorrales
Created Aug 6, 2016
Embed
What would you like to do?
Reading a file With Elixir
defmodule Mix.Tasks.Elixchool.FileProcessor do
use Mix.Task
def run(filePath) do
case File.read(filePath) do
{:ok, body} -> process(body)
{:error, reason} -> errorHandler(reason)
end
end
defp process(content) do
IO.puts content
end
defp errorHandler (error) do
IO.inspect error
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment