exfile v0.2.1 Exfile.ProcessorChain
A module to run a chain of processors on a file.
Summary
Functions
Apply a chain of processors to an uploadable
Types
Functions
Specs
apply_processors([definition, ...], uploadable) ::
{:ok, %Exfile.LocalFile{io: term, meta: term, path: term}} |
{:error, atom}
apply_processors([], uploadable) :: {:ok, uploadable}
Apply a chain of processors to an uploadable.
If the list of processor definitions is empty, it will pass-through the uploadable argument untouched. If the list of processor definitions is not empty, it will coerce the uploadable argument in to a LocalFile, downloading it from the backend if necessary.
The definition list accepts three different terms:
- A string, representing the processor name to apply
- A 2-element tuple:
{string, list of processor arguments}
- A 3-element tuple:
{string, list of processor arguments, list of processor options}
If a processor encounters an error, the chain is halted and the error is
returned immediately in the format {:error, reason}
.