Documentation
¶
Overview ¶
Package filetype contains methods and structs to deal with files (mime, validation, sha, etc.)
Index ¶
- Variables
- func IsGIF(r io.ReadSeeker) (bool, error)
- func IsImage(r io.ReadSeeker) (isValid bool, mimeType string, err error)
- func IsJPG(r io.ReadSeeker) (bool, error)
- func IsPNG(r io.ReadSeeker) (bool, error)
- func MimeType(r io.ReadSeeker) (string, error)
- func SHA256Sum(r io.ReadSeeker) (hash string, err error)
- func ValidateImage(r io.ReadSeeker, decode ImageDecoder) (bool, error)
- type FileValidator
- type ImageDecoder
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMsgUnsupportedImageFormat = "unsupported image format"
ErrMsgUnsupportedImageFormat represents the error message returned for an unsupported image type
Functions ¶
func IsImage ¶
func IsImage(r io.ReadSeeker) (isValid bool, mimeType string, err error)
IsImage checks the specified reader contains an image
func MimeType ¶
func MimeType(r io.ReadSeeker) (string, error)
MimeType returns the mimetype of a file
func SHA256Sum ¶
func SHA256Sum(r io.ReadSeeker) (hash string, err error)
SHA256Sum returns the SHA256 sum of a reader
func ValidateImage ¶
func ValidateImage(r io.ReadSeeker, decode ImageDecoder) (bool, error)
ValidateImage check if an images has a valid format Update when this gets done: https://github.com/golang/go/issues/18098
Types ¶
type FileValidator ¶
type FileValidator func(r io.ReadSeeker) (bool, error)
FileValidator represents a function that can validate a file type
Click to show internal directories.
Click to hide internal directories.