Bow v0.3.0 Bow.Exec View Source
Transform files with shell commands
This module allows executing any external command taking care of temporary path generation and error handling. It is as reliable as erlexec module (very!).
It is also possible to provide custom command timeout. See exec/4
to see all available options.
Link to this section Summary
Functions
Execute command
Link to this section Functions
Execute command
Arguments:
source
- source file to be transformedtarget_name
- target filecommand
- the command to be executed. Placeholders${input}
and${output}
will be replaced with source and target paths
Options:
:timeout
- time in which the command must return. If it's exceeded the command process will be killed.
Examples
# generate image thumbnail from first page of pdf
def transform(file, :pdf_thumbnail) do
Bow.Exec.exec file, filename(file, :pdf_thumbnail),
"convert '${input}[0]' -strip -gravity North -background '#ffffff'" <>
" -resize 250x175^ -extent 250x175 -format png png:${output}"
end