local

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

func NewClient(conf Config) (*Client, error)

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

func (c *Client) DeleteFile(ctx context.Context, key string) error

DeleteFile removes a file from the local filesystem storage.

func (*Client) DownloadFile

func (c *Client) DownloadFile(ctx context.Context, key string) (storage.DownloadResult, error)

DownloadFile retrieves a file from local filesystem storage. Returns the file reader, MIME type based on file extension, and file size.

func (*Client) IsFileExists

func (c *Client) IsFileExists(ctx context.Context, key string) (bool, error)

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

func (c *Client) UploadFile(ctx context.Context, file io.Reader, key string) (string, error)

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.

func (*Client) UploadLocalFile

func (c *Client) UploadLocalFile(ctx context.Context, file string, key string) (string, error)

UploadLocalFile uploads an existing local file to the storage with the specified key. This is useful for moving files within the local filesystem storage.

type Config

type Config struct {
	RootDir string `json:"root_dir" yaml:"root_dir"`
}

Config holds the configuration for local file storage operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL