Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { Save(filePath string, data []byte) error List(dirPath string) ([]FileInfo, error) Delete(filePath string) error DeleteAll(dirPath string) error }
Driver represents an abstraction layer for handling file uploads
type FileSystemDriver ¶
type FileSystemDriver struct {
// contains filtered or unexported fields
}
FileSystemDriver is an implementation of Driver that uses the local file system.
func NewFileSystemDriver ¶
func NewFileSystemDriver(cfg *conf.Config) FileSystemDriver
NewFileSystemDriver constucts a FileSystemDriver.
func (FileSystemDriver) Delete ¶
func (u FileSystemDriver) Delete(filePath string) error
Delete deletes the file at the specified path, if it exists.
func (FileSystemDriver) DeleteAll ¶
func (u FileSystemDriver) DeleteAll(dirPath string) error
DeleteAll deletes all files at or under the specified directory path.
type S3Driver ¶
type S3Driver struct {
// contains filtered or unexported fields
}
S3Driver is an implementation of Driver that uses the Amazon S3.
type S3Static ¶
type S3Static struct { // Prefix is the optional prefix used to serve the static content Prefix string // contains filtered or unexported fields }
S3Static is a middleware handler that serves static files from Amazon S3. If the file does not exist on the S3, it passes along to the next middleware in the chain.
func NewS3Static ¶
NewS3Static returns a new instance of S3Static
func (*S3Static) ServeHTTP ¶
func (s *S3Static) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
Click to show internal directories.
Click to hide internal directories.