Maxwell.Multipart (maxwell v2.4.0) View Source
Process mutipart for adapter
Link to this section 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)
Link to this section Types
Specs
boundary_t() :: String.t()
Specs
Specs
file_content_t() :: binary()
Specs
Specs
headers_t() :: Keyword.t()
Specs
name_t() :: String.t()
Specs
Specs
params_t() :: [param_t()]
Specs
part_t() :: {:file, Path.t()} | {:file, Path.t(), headers_t()} | {:file, Path.t(), disposition_t(), headers_t()} | {:file_content, file_content_t(), String.t()} | {:file_content, file_content_t(), String.t(), headers_t()} | {:file_content, file_content_t(), String.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()}
Specs
t() :: {:multipart, [part_t()]}
Link to this section Functions
Specs
Specs
Specs
Specs
Specs
Specs
add_file(t(), Path.t(), disposition_t(), headers_t()) :: t()
Specs
add_file_content(t(), file_content_t(), String.t()) :: t()
Link to this function
add_file_content(multipart, file_content, filename, extra_headers)
View SourceSpecs
add_file_content(t(), file_content_t(), String.t(), headers_t()) :: t()
Link to this function
add_file_content(multipart, file_content, filename, disposition, extra_headers)
View SourceSpecs
add_file_content( t(), file_content_t(), String.t(), disposition_t(), headers_t() ) :: t()
Link to this function
add_file_content_with_name(multipart, file_content, filename, name, extra_headers \\ [])
View SourceSpecs
Specs
Specs
encode_form(parts :: [part_t()]) :: {boundary_t(), integer()}
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. `{:file_content, file_content, filename}`
5. `{:file_content, file_content, filename, extra_headers}`
6. `{:file_content, file_content, filename, disposition, extra_headers}`
7. `{:mp_mixed, name, mixed_boundary}`
8. `{:mp_mixed_eof, mixed_boundary}`
9. `{name, bin_data}`
10. `{name, bin_data, extra_headers}`
11. `{name, bin_data, disposition, extra_headers}`
Returns {body_binary, size}
Specs
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. `{:file_content, file_content, filename}` 5. `{:file_content, file_content, filename, extra_headers}` 6. `{:file_content, file_content, filename, disposition, extra_headers}` 7. `{:mp_mixed, name, mixed_boundary}` 8. `{:mp_mixed_eof, mixed_boundary}` 9. `{name, bin_data}`
{name, bin_data, extra_headers}
{name, bin_data, disposition, extra_headers}
Specs
len_mp_stream(boundary :: boundary_t(), parts :: [part_t()]) :: integer()
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)
Specs
new() :: t()
create a multipart struct
Specs
new_boundary() :: boundary_t()
Return a random boundary(binary)
Examples
# "---------------------------mtynipxrmpegseog"
boundary = new_boundary()