Documentation
¶
Overview ¶
Package mime implements parts of the MIME spec.
Index ¶
- Variables
- func AddExtensionType(ext, typ string) error
- func ExtensionsByType(typ string) ([]string, error)
- func FormatMediaType(t string, param map[string]string) string
- func ParseMediaType(v string) (mediatype string, params map[string]string, err error)
- func TypeByExtension(filename string) string
- func TypeByExtensionMini(ext string) string
- type WareHouseSdk
- func (w *WareHouseSdk) DelObject(bucket, objectName string) error
- func (w *WareHouseSdk) GetObject(bucket, objectName string) (*models.Object, error)
- func (w *WareHouseSdk) Ping() error
- func (w *WareHouseSdk) PutObject(bucketName, objectName string, data []byte, metaData *models.MetaData) error
- func (w *WareHouseSdk) RemoveBucket(bucket string) error
Constants ¶
This section is empty.
Variables ¶
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 AddExtensionType ¶
AddExtensionType sets the MIME type associated with the extension ext to typ. The extension should begin with a leading dot, as in ".html".
func ExtensionsByType ¶
ExtensionsByType returns the extensions known to be associated with the MIME type typ. The returned extensions will each begin with a leading dot, as in ".html". When typ has no associated extensions, ExtensionsByType returns an nil slice.
func FormatMediaType ¶
FormatMediaType serializes mediatype t and the parameters param as a media type conforming to RFC 2045 and RFC 2616. The type and parameter names are written in lower-case. When any of the arguments result in a standard violation then FormatMediaType returns the empty string.
func ParseMediaType ¶
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. If there is an error parsing the optional parameter, the media type will be returned along with the error ErrInvalidMediaParameter. The returned map, params, maps from the lowercase attribute to the attribute value with its case preserved.
func TypeByExtension ¶
func TypeByExtensionMini ¶
TypeByExtension returns the MIME type associated with the file extension ext. The extension ext should begin with a leading dot, as in ".html". When ext has no associated type, TypeByExtension returns "".
Extensions are looked up first case-sensitively, then case-insensitively.
The built-in table is small but on unix it is augmented by the local system's mime.types file(s) if available under one or more of these names:
/etc/mime.types /etc/apache2/mime.types /etc/apache/mime.types
On Windows, MIME types are extracted from the registry.
Text types have the charset parameter set to "utf-8" by default.
Types ¶
type WareHouseSdk ¶
type WareHouseSdk struct {
// contains filtered or unexported fields
}
func (*WareHouseSdk) DelObject ¶
func (w *WareHouseSdk) DelObject(bucket, objectName string) error
func (*WareHouseSdk) GetObject ¶
func (w *WareHouseSdk) GetObject(bucket, objectName string) (*models.Object, error)
func (*WareHouseSdk) Ping ¶
func (w *WareHouseSdk) Ping() error
func (*WareHouseSdk) RemoveBucket ¶
func (w *WareHouseSdk) RemoveBucket(bucket string) error