View Source Multipart.Part (Multipart v0.4.0)
Represents an individual part of a Multipart
message.
Link to this section Summary
Functions
Builds a Part
with a binary body.
Builds a Part
with a streaming file body.
Builds a form-data Part
with an in-memory file body.
Builds a form-data Part
with a streaming file body.
Builds a Part
with a Stream
body.
Builds a form-data Part
with a streaming body.
Builds a form-data Part
with a text body.
Link to this section Types
Link to this section Functions
Builds a Part
with a binary body.
Set the content_length
of the Part
to the length of the binary.
Builds a Part
with a streaming file body.
Set the content_length
of the Part
to the size of the file on disk, as
inspected with File.stat
.
file_content_field(path, content, name, headers \\ [], opts \\ [])
View SourceBuilds a form-data Part
with an in-memory file body.
Takes the following Keyword
options in opts
:
filename
: controls the inclusion of thefilename="foo"
directive in thecontent-disposition
header. Defaults totrue
, which uses the filename from the path on disk. Pass in aString
to override this, or set tofalse
to disable this directive.content_type
: controls the inclusion of thecontent-type
header. Defaults totrue
which will useMIME.from_path/1
to detect the mime type of the file. Pass in aString
to override this, or set tofalse
to disable this header.
Builds a form-data Part
with a streaming file body.
Takes the following Keyword
options in opts
:
filename
: controls the inclusion of thefilename="foo"
directive in thecontent-disposition
header. Defaults totrue
, which uses the filename from the path on disk. Pass in aString
to override this, or set tofalse
to disable this directive.content_type
: controls the inclusion of thecontent-type
header. Defaults totrue
which will useMIME.from_path/1
to detect the mime type of the file. Pass in aString
to override this, or set tofalse
to disable this header.
Builds a Part
with a Stream
body.
Because the length of the Stream
cannot be known up front it doesn't
define the content_length
. This will cause Multipart.content_length/1
to error unless you set the content_length
manually in the struct.
Builds a form-data Part
with a streaming body.
Builds a form-data Part
with a text body.