Documentation
¶
Index ¶
- type Streamer
- func (s *Streamer) Close() error
- func (s *Streamer) ContentType() string
- func (s *Streamer) CreateFormField(fieldname string, r io.Reader, length int64) error
- func (s *Streamer) CreateFormFile(fieldname, filename string, r io.Reader, length int64) error
- func (s *Streamer) CreatePart(h textproto.MIMEHeader, r io.Reader, length int64) error
- func (s *Streamer) Finalize() error
- func (s *Streamer) Len() int64
- func (s *Streamer) LenString() string
- func (s *Streamer) Read(buf []byte) (int, error)
- func (s *Streamer) WriteField(fieldname, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Streamer ¶
type Streamer struct {
// contains filtered or unexported fields
}
Streamer is an implementation of a multipart.Writer which allows you to read directly from it
func (*Streamer) Close ¶
Close check every part that may be an io.ReadCloser this isn't necessary if the ReadClosers are manually closed after the request This function itself makes the Streamer an io.Closer
func (*Streamer) ContentType ¶
ContentType returns the request's content type
func (*Streamer) CreateFormField ¶
CreateFormField calls CreatePart with a header using the given field name.
func (*Streamer) CreateFormFile ¶
CreateFormFile is a convenience wrapper around CreatePart. It creates a new form-data header with the provided field name and file name.
func (*Streamer) CreatePart ¶
CreatePart functions the same as multipart's CreatePart, but takes a reader instead of returning a writer.
func (*Streamer) Finalize ¶
Finalize is called when the reader is attempted to be read from, and it does not have an underlying reader to use. It will close the multipart writer, flushing the final part, and append all readers together making us a reader that is able to simply append all the parts as one stream.
func (*Streamer) Read ¶
Read implements an io.Reader that can be used to read from this multipart streamer This finalizes the request (with mw.Close) and prepares a reader for reading if it is not ready.
func (*Streamer) WriteField ¶
WriteField calls CreateFormField and then writes the given value.