multipartreader

package
v3.3.2-mips+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package multipartreader helps you encode large files in MIME multipart format without reading the entire content into memory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultipartReader

type MultipartReader struct {
	// contains filtered or unexported fields
}

MultipartReader MIME multipart format

func NewMultipartReader

func NewMultipartReader() (mr *MultipartReader)

NewMultipartReader 返回初始化的 *MultipartReader

func (*MultipartReader) AddFormFeild

func (mr *MultipartReader) AddFormFeild(fieldname string, readerlen ReaderLen)

AddFormFeild 增加 form 表单

func (*MultipartReader) AddFormFile

func (mr *MultipartReader) AddFormFile(fieldname, filename string, readerlen64 ReaderLen64)

AddFormFile 增加 form 文件表单

func (*MultipartReader) ContentType

func (mr *MultipartReader) ContentType() string

ContentType 返回 Content-Type

func (*MultipartReader) Len

func (mr *MultipartReader) Len() int64

Len 返回表单内容总长度

func (*MultipartReader) Read

func (mr *MultipartReader) Read(p []byte) (n int, err error)

func (*MultipartReader) Readed

func (mr *MultipartReader) Readed() int64

Readed 返回 form 表单已读取的数据量, 用于计算上传速度等

func (*MultipartReader) SetupHTTPRequest

func (mr *MultipartReader) SetupHTTPRequest(req *http.Request)

SetupHTTPRequest 为 *http.Request 配置

type ReadedLen64

type ReadedLen64 interface {
	ReaderLen64
	Readed() int64
}

ReadedLen64 实现io.Reader, 64-bit长度接口和已读取数据量接口

func NewFileReadedLen64

func NewFileReadedLen64(f *os.File) ReadedLen64

NewFileReadedLen64 *os.File 实现 ReadedLen64 接口

type ReaderLen

type ReaderLen interface {
	io.Reader
	Len() int
}

ReaderLen 实现io.Reader和32-bit长度接口

type ReaderLen64

type ReaderLen64 interface {
	io.Reader
	Len() int64
}

ReaderLen64 实现io.Reader和64-bit长度接口

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL