Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HandleS3Uploads ¶
func HandleS3Uploads(bucket string) httprouter.Handle
HandleS3Uploads returns a handler that serves static files from Amazon S3. If the file does not exist on the S3, a 404 is returned.
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.
Click to show internal directories.
Click to hide internal directories.