s3

package
v0.1.0-rc.7 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: AGPL-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 Service

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

Service provides methods for interacting with AWS S3

func NewS3Service

func NewS3Service(bucket string) (*Service, error)

NewS3Service creates a new S3 service instance

func (*Service) BulkDeleteFiles

func (s *Service) BulkDeleteFiles(ctx context.Context, uploadedKeys []string)

BulkDeleteFiles deletes multiple files from S3

func (*Service) BulkUploadFiles

func (s *Service) BulkUploadFiles(ctx context.Context, payloads []*s3.PutObjectInput) ([]string, error)

BulkUploadFiles uploads multiple files given a list of payloads. Auto rollback if there are errors

func (*Service) DeleteFile

func (s *Service) DeleteFile(ctx context.Context, s3Path, filename, s3Key *string) error

DeleteFile deletes a file from S3

func (*Service) FileExists

func (s *Service) FileExists(ctx context.Context, s3Path, filename string) (bool, error)

FileExists checks if a file exists in S3

func (*Service) GeneratePreSignedDownloadURL

func (s *Service) GeneratePreSignedDownloadURL(ctx context.Context, s3Path, filename string, expirationSeconds int64) (string, error)

GeneratePreSignedDownloadURL generates a pre-signed URL for downloading a file from S3 The URL will be valid for the specified duration (in seconds)

func (*Service) GenerateUploadPayload

func (s *Service) GenerateUploadPayload(ctx context.Context, data []byte, s3Path, filename string, metadata map[string]string) (*s3.PutObjectInput, error)

GenerateUploadPayload generates a payload for uploading a file to S3 have the same signature as UploadFile, but return the payload instead of uploading for bulk upload

func (*Service) UploadFile

func (s *Service) UploadFile(ctx context.Context, data []byte, s3Path, filename string, metadata map[string]string) error

UploadFile uploads a file to S3 with the given path and filename metadata is optional - if nil, no metadata will be added

Jump to

Keyboard shortcuts

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