s3ext

package
v2.0.0-...-1fe9aa2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "s3"
)

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, client *Client) context.Context

Types

type Client

type Client struct {
	Configs
	// contains filtered or unexported fields
}

func Dial

func Dial(configs Configs) (*Client, error)

func FromContext

func FromContext(ctx context.Context) *Client

func (*Client) DeleteWithContext

func (c *Client) DeleteWithContext(ctx context.Context, filepath string) error

func (*Client) DownloadByURLWithContext

func (c *Client) DownloadByURLWithContext(ctx context.Context, uri url.URL) ([]byte, error)

func (*Client) DownloadWithContext

func (c *Client) DownloadWithContext(ctx context.Context, filepath string) ([]byte, error)

func (*Client) Upload

func (c *Client) Upload(filename string, data []byte, public bool) (*url.URL, error)

func (*Client) UploadWithContext

func (c *Client) UploadWithContext(ctx context.Context, filepath string, data []byte, public bool) (*url.URL, error)

type Configs

type Configs struct {
	S3EndpointURL  url.URL       `env:"S3_ENDPOINT_URL,required"`
	S3AccessKey    string        `env:"S3_ACCESS_KEY,required"`
	S3SecretKey    string        `env:"S3_SECRET_KEY,required"`
	S3BucketName   string        `env:"S3_BUCKET_NAME,required"`
	S3Timeout      time.Duration `env:"S3_TIMEOUT" envDefault:"5s"`
	S3MaxRetries   int           `env:"S3_MAX_RETRIES" envDefault:"3"`
	S3BufferSize   int           `env:"S3_BUFFER_SIZE_KB" envDefault:"500"`
	S3BufferGrowth float64       `env:"S3_BUFFER_GROWTH" envDefault:"1.8"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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