Documentation
¶
Index ¶
Constants ¶
View Source
const FileNotFoundErr = "File not found"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LocalStorage ¶
type LocalStorage struct {
// contains filtered or unexported fields
}
LocalStorage implements Storage using disk.
func NewLocalStorage ¶
func NewLocalStorage(p string) *LocalStorage
NewLocalStorage returns Storage implementation using disk.
func (*LocalStorage) GetAllInfo ¶
func (l *LocalStorage) GetAllInfo() (*[]StorageFile, error)
GetAllInfo return all files contained in the storage.
func (*LocalStorage) Save ¶
func (l *LocalStorage) Save(fpath string, r io.Reader) error
Save saves new file in path with content contained in r.
func (*LocalStorage) Write ¶
func (l *LocalStorage) Write(fpath string, w io.Writer) (*StorageFile, error)
Write writes file contained in path into given w.
type Storage ¶
type Storage interface { // Save creates file in fpath from r. Save(fpath string, f io.Reader) error // GetAllInfo return all StorageFiles. GetAllInfo() (*[]StorageFile, error) // Write writes StorageFile into given w. Write(fpath string, w io.Writer) (*StorageFile, error) }
Storage defines file operations.
type StorageFile ¶
StorageFile represents file located in Storage.
func NewStorageFile ¶
func NewStorageFile(f *os.File) (*StorageFile, error)
NewStorageFile creates StorageFile from file descriptor f.
Click to show internal directories.
Click to hide internal directories.