Documentation
¶
Index ¶
Constants ¶
const ( DefaultMaxFileSize = 10 << 20 DefaultMaxParseCount = 20 DefaultMaxFileCount = 0 ExtractDir = "acc28d87-f8ec-4816-8b8f" RemoveBytes = 16 RetrySleep = 3 * time.Second )
Variables ¶
var ( ErrMaxFileCountExceeded = errors.New("max file count to save exceeded") ErrExtensionNotFound = errors.New("can't detect file's extension") )
Functions ¶
func CheckForUpdates ¶
main fix: use HOME on Unix, USERPROFILE on Windows, print where extracting, print all extracted files and their permissions
Types ¶
type DefaultInspector ¶
type DefaultInspector struct {
// contains filtered or unexported fields
}
DefaultInspector is the default inspector uses http.DetectContentType function to find the content type
func (*DefaultInspector) Inspect ¶
func (inspector *DefaultInspector) Inspect(data []byte) string
Inspect finds the content type of the byte array
type ExtensionFilter ¶
type ExtensionFilter struct {
// contains filtered or unexported fields
}
ExtensionFilter is a filter which filters the unwanted extensions passes the part if the part's extension is in the extensions field
func (*ExtensionFilter) Filter ¶
func (f *ExtensionFilter) Filter(part *Part) bool
Filter function filters the part with it's extension
type FilesystemStorage ¶
type FilesystemStorage struct {
Path string
}
FilesystemStorage is the default store to save parts
func NewFilesystemStorage ¶
func NewFilesystemStorage(path string) FilesystemStorage
NewFilesystemStorage creates a new FilesystemStorage
type Filter ¶
Filter is a interface which wraps the Filter function you can create your own filters with this
func NewExtensionFilter ¶
NewExtensionFilter creates a new extension filter
type Inspector ¶
Inspector is a interface for finding the content type of the byte array
func NewDefaultInspector ¶
NewDefaultInspector creates a new default inspector
type Parser ¶
type Parser struct {
Options ParserOptions
Filter Filter
Inspector Inspector
}
Parser contains parsing options and interfaces to do some other actions
func DefaultParser ¶
func DefaultParser() *Parser
DefaultParser creates a new parser with the default settings
func (*Parser) Parse ¶
Parse parses the http request with the multipart.Reader. reads parts inside the loop which iterates up to MaxParseCount at most. creates a []byte (buf) which gonna contain the part data.
func (*Parser) SetInspector ¶
SetInspector sets the inspector of the parser
type ParserOptions ¶
ParserOptions contains parser's options about parsing.
type Part ¶
type Part struct {
Name string
Headers textproto.MIMEHeader
Size int
Content []byte
Extension string
}
Part is a struct that you can access the all contents of the multipart.Part
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request contains parts to use in other transactions.
func NewRequest ¶
NewRequest creates a new Request