maxwell v2.2.2 Maxwell.Multipart
Process mutipart for adapter
Summary
Functions
multipart form encode
multipart form encode
Get the size of a mp stream. Useful to calculate the content-length of a full multipart stream and send it as an identity
create a multipart struct
Return a random boundary(binary)
Types
part_t()
part_t :: {:file, Path.t} | {:file, Path.t, headers_t} | {:file, Path.t, disposition_t, headers_t} | {:mp_mixed, String.t, boundary_t} | {:mp_mixed_eof, boundary_t} | {name_t, binary} | {name_t, binary, headers_t} | {name_t, binary, disposition_t, headers_t}
Functions
add_field(multipart, name, value, disposition, extra_headers)
add_field(t, String.t, binary, disposition_t, headers_t) :: t
add_file(multipart, path, disposition, extra_headers)
add_file(t, Path.t, disposition_t, headers_t) :: t
multipart form encode.
* `parts` - receives lists list's member format:
1. `{:file, path}`
2. `{:file, path, extra_headers}`
3. `{:file, path, disposition, extra_headers}`
4. `{:mp_mixed, name, mixed_boundary}`
5. `{:mp_mixed_eof, mixed_boundary}`
6. `{name, bin_data}`
7. `{name, bin_data, extra_headers}`
8. `{name, bin_data, disposition, extra_headers}`
Returns {body_binary, size}
encode_form(boundary, parts)
encode_form(boundary :: boundary_t, parts :: [part_t]) :: {boundary_t, integer}
multipart form encode.
boundary
- multipart boundary.parts
- receives lists list's member format:1. `{:file, path}` 2. `{:file, path, extra_headers}` 3. `{:file, path, disposition, extra_headers}` 4. `{:mp_mixed, name, mixed_boundary}` 5. `{:mp_mixed_eof, mixed_boundary}` 6. `{name, bin_data}` 7. `{name, bin_data, extra_headers}` 8. `{name, bin_data, disposition, extra_headers}`
Get the size of a mp stream. Useful to calculate the content-length of a full multipart stream and send it as an identity
* `boundary` - multipart boundary
* `parts` - see `Maxwell.Multipart.encode_form`.
Returns stream size(integer)
create a multipart struct
Return a random boundary(binary)
Examples
# "---------------------------mtynipxrmpegseog"
boundary = new_boundary()