s3

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Region          string
	Bucket          string
	AccessKeyId     string
	SecretAccessKey string
}

type FileInfo

type FileInfo struct {
	FileID       string `json:"file_id"`
	FileExt      string `json:"file_ext"`
	FileMimetype string `json:"file_mimetype"`
	FileSize     int    `json:"file_size"`
	ETag         string `json:"etag"`
	Timestamp    string `json:"timestamp"`
}

type PublicLinkResponse

type PublicLinkResponse struct {
	Url       string `json:"url"`
	ExpiredAt string `json:"expired_at"`
}

type S3

type S3 struct {
	// contains filtered or unexported fields
}

func NewS3

func NewS3(ctx context.Context, cfg Config) (*S3, error)

func (*S3) Delete

func (s *S3) Delete(ctx context.Context, fileId string) error

func (*S3) Download added in v1.1.0

func (s *S3) Download(ctx context.Context, fileId, path string) (*os.File, error)

func (*S3) DownloadAsBase64 added in v1.1.0

func (s *S3) DownloadAsBase64(ctx context.Context, fileId string) (string, error)

func (*S3) FileInfo added in v1.1.0

func (s *S3) FileInfo(ctx context.Context, fileId string) (FileInfo, error)
func (s *S3) PublicLink(
	ctx context.Context,
	fileId string,
	publicLinkExpiration time.Duration,
) (PublicLinkResponse, error)

func (*S3) Upload

func (s *S3) Upload(ctx context.Context, file io.ReadSeeker, name, ext string) (FileInfo, error)

func (*S3) UploadFromBase64 added in v1.1.0

func (s *S3) UploadFromBase64(ctx context.Context, base64String, name, ext string) (FileInfo, error)

Jump to

Keyboard shortcuts

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