Documentation ¶
Index ¶
- Variables
- type Backend
- func (b *Backend) Delete(path string) error
- func (b *Backend) Exists(path string) (bool, error)
- func (b *Backend) GetAlternateName(fileRoot, fileExt string) string
- func (b *Backend) GetAvailableName(path string, retries int, max_length int) (string, error)
- func (b *Backend) ListDir(path string) ([]string, error)
- func (b *Backend) Open(name string) (mediafiles.StoredObject, error)
- func (b *Backend) Save(path string, file io.Reader, maxLength ...int) (string, error)
- func (b *Backend) Stat(path string) (mediafiles.FileHeader, error)
- type File
- type FileHeader
Constants ¶
This section is empty.
Variables ¶
var (
DEFAULT_RETRIES = 5
)
Functions ¶
This section is empty.
Types ¶
type Backend ¶
func NewBackend ¶
func (*Backend) Delete ¶
Deletes the file referenced by name. If deletion is not supported on the target storage system this will return ErrNotImplemented.
func (*Backend) Exists ¶
Returns True if a file referenced by the given name already exists in the storage system.
func (*Backend) GetAlternateName ¶
Returns an alternative filename based on the file_root and file_ext parameters, an underscore plus a random 7 character alphanumeric string is appended to the filename before the extension.
func (*Backend) GetAvailableName ¶
Returns a filename based on the name parameter that’s free and available for new content to be written to on the target storage system.
The length of the filename will not exceed max_length, if provided. If a free unique filename cannot be found, ErrSuspiciousOperation will be returned.
func (*Backend) ListDir ¶
Lists the contents of the specified path, returning a 2-tuple of lists; the first item being directories, the second item being files. For storage systems that aren’t able to provide such a listing, this will return ErrNotImplemented.
func (*Backend) Open ¶
func (b *Backend) Open(name string) (mediafiles.StoredObject, error)
func (*Backend) Save ¶
Saves a new file using the storage system, preferably with the name specified. If there already exists a file with this name name, the storage system may modify the filename as necessary to get a unique name. The actual name of the stored file will be returned.
The maxLength parameter is passed to GetAvailableName() and is used to limit the length of the filename before saving. If the file is too large to be saved, this will raise a SuspiciousOperation exception.
func (*Backend) Stat ¶
func (b *Backend) Stat(path string) (mediafiles.FileHeader, error)
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) Stat ¶
func (f *File) Stat() (mediafiles.FileHeader, error)
type FileHeader ¶
type FileHeader struct {
// contains filtered or unexported fields
}
func (*FileHeader) Name ¶
func (h *FileHeader) Name() string
func (*FileHeader) Path ¶
func (h *FileHeader) Path() string
func (*FileHeader) Size ¶
func (h *FileHeader) Size() int64
func (*FileHeader) TimeAccessed ¶
func (h *FileHeader) TimeAccessed() (t time.Time, err error)
func (*FileHeader) TimeCreated ¶
func (h *FileHeader) TimeCreated() (t time.Time, err error)
func (*FileHeader) TimeModified ¶
func (h *FileHeader) TimeModified() (t time.Time, err error)