Documentation ¶
Overview ¶
Package multipart implements MIME multipart parsing, as defined in RFC 2046.
The implementation is sufficient for HTTP (RFC 2388) and the multipart bodies generated by popular browsers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Part ¶
type Part struct { // The headers of the body, if any, with the keys canonicalized // in the same fashion that the Go http.Request headers are. // For example, "foo-bar" changes case to "Foo-Bar" Header textproto.MIMEHeader // contains filtered or unexported fields }
A Part represents a single part in a multipart body.
func (*Part) FileName ¶
FileName returns the filename parameter of the Part's Content-Disposition header.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is an iterator over parts in a MIME multipart body. Reader's underlying parser consumes its input as needed. Seeking isn't supported.
func NewReader ¶
NewReader creates a new multipart Reader reading from r using the given MIME boundary.
The boundary is usually obtained from the "boundary" parameter of the message's "Content-Type" header. Use mime.ParseMediaType to parse such headers.
func (*Reader) NextPart ¶
NextPart returns the next part in the multipart or an error. When there are no more parts, the error io.EOF is returned.
As a special case, if the "Content-Transfer-Encoding" header has a value of "quoted-printable", that header is instead hidden and the body is transparently decoded during Read calls.
func (*Reader) NextRawPart ¶
NextRawPart returns the next part in the multipart or an error. When there are no more parts, the error io.EOF is returned.
Unlike NextPart, it does not have special handling for "Content-Transfer-Encoding: quoted-printable".