Documentation ¶
Overview ¶
Package fsstorage is an implementation of filestorage using the filesystem
Index ¶
- type Creator
- type FSStorage
- func (s *FSStorage) Attributes(filepath string) (*filestorage.FileAttributes, error)
- func (s *FSStorage) AttributesCtx(ctx context.Context, filepath string) (*filestorage.FileAttributes, error)
- func (s *FSStorage) Delete(filepath string) error
- func (s *FSStorage) DeleteCtx(ctx context.Context, filepath string) error
- func (s *FSStorage) Exists(filepath string) (bool, error)
- func (s *FSStorage) ExistsCtx(ctx context.Context, filepath string) (bool, error)
- func (s *FSStorage) ID() string
- func (s *FSStorage) Read(filepath string) (io.ReadCloser, error)
- func (s *FSStorage) ReadCtx(ctx context.Context, filepath string) (io.ReadCloser, error)
- func (s *FSStorage) SetAttributes(filepath string, attrs *filestorage.UpdatableFileAttributes) (*filestorage.FileAttributes, error)
- func (s *FSStorage) SetAttributesCtx(ctx context.Context, filepath string, ...) (*filestorage.FileAttributes, error)
- func (s *FSStorage) SetBucket(name string) error
- func (s *FSStorage) URL(filepath string) (string, error)
- func (s *FSStorage) URLCtx(ctx context.Context, filepath string) (string, error)
- func (s *FSStorage) Write(src io.Reader, destPath string) error
- func (s *FSStorage) WriteCtx(ctx context.Context, src io.Reader, destPath string) error
- func (s *FSStorage) WriteIfNotExist(src io.Reader, destPath string) (new bool, url string, err error)
- func (s *FSStorage) WriteIfNotExistCtx(ctx context.Context, src io.Reader, destPath string) (new bool, url string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Creator ¶
type Creator struct {
// contains filtered or unexported fields
}
Creator creates new filestorage
func NewCreator ¶
NewCreator returns a filestorage creator that will use the provided keys to create a new cloudinary driver for each single logger
type FSStorage ¶
type FSStorage struct {
// contains filtered or unexported fields
}
FSStorage is an implementation of the FileStorage interface for the file system
func NewWithContext ¶
NewWithContext returns a new GCStorage instance using a new Google Cloud Storage client attached to the provided context
func NewWithDir ¶
NewWithDir returns a new instance of a File System Storage with
func (*FSStorage) Attributes ¶
Attributes returns the attributes of the file Will use the defaut context
func (*FSStorage) AttributesCtx ¶
func (s *FSStorage) AttributesCtx(ctx context.Context, filepath string) (*filestorage.FileAttributes, error)
AttributesCtx returns the attributes of the file
func (*FSStorage) Delete ¶
Delete removes a file, ignores files that do not exist Will use the defaut context
func (*FSStorage) Read ¶
func (s *FSStorage) Read(filepath string) (io.ReadCloser, error)
Read fetches a file a returns a reader Will use the defaut context
func (*FSStorage) SetAttributes ¶
func (s *FSStorage) SetAttributes(filepath string, attrs *filestorage.UpdatableFileAttributes) (*filestorage.FileAttributes, error)
SetAttributes sets the attributes of the file Will use the defaut context
func (*FSStorage) SetAttributesCtx ¶
func (s *FSStorage) SetAttributesCtx(ctx context.Context, filepath string, attrs *filestorage.UpdatableFileAttributes) (*filestorage.FileAttributes, error)
SetAttributesCtx sets the attributes of the file
func (*FSStorage) WriteIfNotExist ¶
func (s *FSStorage) WriteIfNotExist(src io.Reader, destPath string) (new bool, url string, err error)
WriteIfNotExist copies the provided io.Reader to dest if the file does not already exist Returns:
- A boolean specifying if the file got uploaded (true) or if already existed (false).
- A URL to the uploaded file
- An error if something went wrong
Will use the defaut context
func (*FSStorage) WriteIfNotExistCtx ¶
func (s *FSStorage) WriteIfNotExistCtx(ctx context.Context, src io.Reader, destPath string) (new bool, url string, err error)
WriteIfNotExistCtx copies the provided io.Reader to dest if the file does not already exist Returns:
- A boolean specifying if the file got uploaded (true) or if already existed (false).
- A URL to the uploaded file
- An error if something went wrong