ivar v0.8.1 Ivar.Files
Ivar.Files
manages the files to be sent for a request
Summary
Functions
Puts the given files
into the existing request
map
Functions
Puts the given files
into the existing request
map
Args
request
- the map used to store the map of headers, usually created viaIvar.new/2
files
- the files to be put into the files list
Files
- tuple -
{"field_name", "some iodata", "file name", "mime type | file extension"}
- the last element of the tuple is optional and the file name will be used to resolve the mime type - list - a list of tuples in the same format as above
Usage
file_data = File.read!("/some/image.png")
Ivar.Files.put(%{}, {"file", file_data, "image.png"})
# %{files: [{"file", <<1, 2, 3, ...>>, {"form-data", [{"name", "file"}, {"filename", "image.png"}]}, [{"content-type", "image/png"}]}]}