View Source Reactor.File
A Reactor extension that provides steps for working with the local filesytem.
Example
The following example uses Reactor to reverse all the files in the specified directory.
defmodule ReverseFilesInDirectory do
use Reactor, extensions: [Reactor.File]
input :directory
glob :all_files do
pattern input(:directory), transform: &Path.join(&1, "*")
end
map :reverse_files do
source result(:all_files)
file_read :read_file do
path element(:reverse_files)
end
step :reverse_content do
argument :content, result(:read_file)
run &{:ok, &String.reverse(&1.content)}
end
file_write :write_file do
path element(:reverse_files)
contents result(:reverse_content)
end
return :write_file
end
return :reverese_files
end
Reactor.run!(ReverseFilesInDirectory, %{directory: "./to_reverse"})
Installation
If available in Hex, the package can be installed
by adding reactor_file
to your list of dependencies in mix.exs
:
def deps do
[
{:reactor_file, "~> 0.9.0"}
]
end
Documentation for the latest release is available on HexDocs.
Github Mirror
This repository is mirrored on Github from it's primary location on my Forgejo instance. Feel free to raise issues and open PRs on Github.
License
This software is licensed under the terms of the
HL3-FULL, see the LICENSE.md
file included with
this package for the terms.
This license actively proscribes this software being used by and for some industries, countries and activities. If your usage of this software doesn't comply with the terms of this license, then contact me with the details of your use-case to organise the purchase of a license - the cost of which may include a donation to a suitable charity or NGO.