mime

package module
v0.0.0-...-844b43b Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2018 License: MIT Imports: 25 Imported by: 0

README

mime

Documentation

Index

Constants

View Source
const (
	ContentTypeMessageRfc822 = "message/rfc822"
)

Variables

View Source
var (
	ErrEmptyHeaderBlock = errors.New("empty header block")
	// ErrorMalformedBase64 name
	ErrorMalformedBase64 = errors.New("malformed base64")
	// ErrorMalformedHeader name
	ErrorMalformedHeader = errors.New("malformed header")
	// ErrorMissingBoundary name
	ErrorMissingBoundary = errors.New("missing boundary")
	// ErrorMissingContentType name
	ErrorMissingContentType = errors.New("missing Content-Type")
	// ErrorCharsetConversion name
	ErrorCharsetConversion = errors.New("character set conversion")
	// ErrorContentEncoding name
	ErrorContentEncoding = errors.New("content encoding")
)
View Source
var ErrInvalidMediaParameter = errors.New("mime: invalid media parameter")

ErrInvalidMediaParameter is returned by ParseMediaType if the media type value was found but there was an error parsing the optional parameters

Functions

func ParseMediaType

func ParseMediaType(v string) (mediatype string, params map[string]string, err error)

ParseMediaType parses a media type value and any optional parameters, per RFC 1521. Media types are the values in Content-Type and Content-Disposition headers (RFC 2183). On success, ParseMediaType returns the media type converted to lowercase and trimmed of white space and a non-nil map. The returned map, params, maps from the lowercase attribute to the attribute value with its case preserved.

Types

type Part

type Part struct {
	Descriptor string

	ContentType       string
	ContentParams     map[string]string
	Disposition       string
	DispositionParams map[string]string
	Encoding          string
	Charset           string
	Filename          string

	Size  int
	Lines int

	Parent       *Part
	Subparts     []*Part
	Header       textproto.MIMEHeader
	HeaderReader io.Reader

	PartOffset, HeaderLen, PartLen int
	Epilogue                       []byte
	Errors                         []error
	// contains filtered or unexported fields
}

func NewPart

func NewPart(parent *Part) *Part

func ReadParts

func ReadParts(r io.Reader) (*Part, error)

func (*Part) Close

func (p *Part) Close() error

func (*Part) Decode

func (p *Part) Decode() (io.Reader, error)

func (*Part) RawReader

func (p *Part) RawReader() io.Reader

func (*Part) Read

func (p *Part) Read(b []byte) (int, error)

func (*Part) String

func (p *Part) String() string

func (*Part) Walk

func (p *Part) Walk(v PartVisitor) error

type PartVisitor

type PartVisitor func(p *Part) error

type ReaderAtCloser

type ReaderAtCloser interface {
	io.ReaderAt
	io.Closer
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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