Documentation
¶
Index ¶
- type Client
- func (c *Client) CopyFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
- func (c *Client) DeleteFile(ctx context.Context, key string) error
- func (c *Client) DownloadFile(ctx context.Context, key string) (storage.DownloadResult, error)
- func (c *Client) IsFileExists(ctx context.Context, key string) (bool, error)
- func (c *Client) MoveFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
- func (c *Client) UploadFile(ctx context.Context, file io.Reader, key string) (string, error)
- func (c *Client) UploadLocalFile(ctx context.Context, file string, key string) (string, error)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides local filesystem storage operations. It implements the Storage interface for file operations on the local filesystem.
func NewClient ¶
NewClient creates a new local storage client with the provided configuration. It validates the root directory and creates it if it doesn't exist. Returns an error if the root directory cannot be created or is invalid.
func (*Client) CopyFile ¶
func (c *Client) CopyFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
CopyFile duplicates a file from source to destination key within local filesystem storage. Creates necessary directory structure and handles overwrite logic.
func (*Client) DeleteFile ¶
DeleteFile removes a file from the local filesystem storage.
func (*Client) DownloadFile ¶
DownloadFile retrieves a file from local filesystem storage. Returns the file reader, MIME type based on file extension, and file size.
func (*Client) IsFileExists ¶
IsFileExists checks whether a file exists in the local filesystem storage.
func (*Client) MoveFile ¶
func (c *Client) MoveFile(ctx context.Context, sourceKey string, destinationKey string, overwrite bool) error
MoveFile relocates a file from source to destination key within local filesystem storage. Creates necessary directory structure and handles overwrite logic.
func (*Client) UploadFile ¶
UploadFile uploads data from a reader to the local filesystem with the specified key. It creates the necessary directory structure and writes the file content.