Documentation ¶
Index ¶
- Variables
- type BaseStorage
- type ContentFile
- type File
- type FileSystemStorage
- func (s *FileSystemStorage) Delete(path string) error
- func (s *FileSystemStorage) Exists(path string) bool
- func (s *FileSystemStorage) Open(path string) (File, error)
- func (s *FileSystemStorage) Save(path string, f File) error
- func (s *FileSystemStorage) SaveWithPermissions(path string, f File, perm os.FileMode) error
- type Storage
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultFilePermissions os.FileMode = 0755
Functions ¶
This section is empty.
Types ¶
type BaseStorage ¶
type BaseStorage struct {
Location string
}
func NewBaseStorage ¶
func NewBaseStorage(location string) *BaseStorage
NewBaseStorage creates a new base storage
func (*BaseStorage) PathWithPrefix ¶
func (s *BaseStorage) PathWithPrefix(filepath string) string
Path makes the absolte path for the file
type ContentFile ¶
func NewContentFile ¶
func NewContentFile(content []byte) *ContentFile
func (*ContentFile) Checksum ¶
func (f *ContentFile) Checksum() string
func (*ContentFile) Close ¶
func (f *ContentFile) Close() error
func (*ContentFile) ReadAll ¶
func (f *ContentFile) ReadAll() ([]byte, error)
func (*ContentFile) Size ¶
func (f *ContentFile) Size() int64
type FileSystemStorage ¶
type FileSystemStorage struct {
*BaseStorage
}
FileSystemStorage is a file system storage handler
func (*FileSystemStorage) Delete ¶
func (s *FileSystemStorage) Delete(path string) error
Delete a file
func (*FileSystemStorage) Exists ¶
func (s *FileSystemStorage) Exists(path string) bool
Exists checks if a file exists
func (*FileSystemStorage) Open ¶
func (s *FileSystemStorage) Open(path string) (File, error)
Open file and get contents
func (*FileSystemStorage) Save ¶
func (s *FileSystemStorage) Save(path string, f File) error
Save a file
func (*FileSystemStorage) SaveWithPermissions ¶
Save with file permissions
type Storage ¶
type Storage interface { Save(path string, f File) error Exists(path string) bool Delete(path string) error Open(path string) (File, error) PathWithPrefix(path string) string }
Storage is an interface for multiple storage engines
func NewFileSystemStorage ¶
NewFileSystemStorage returns a file system storage engine
Click to show internal directories.
Click to hide internal directories.