Documentation
¶
Index ¶
- func IsS3URL(rawURL string) bool
- func ParseS3URL(s3URL string) (bucket, key string, err error)
- type Client
- func (s *Client) DeleteFile(ctx context.Context, key string) error
- func (s *Client) Download(ctx context.Context, key string) ([]byte, error)
- func (s *Client) FileExists(ctx context.Context, key string) (bool, error)
- func (s *Client) GeneratePresignedURL(ctx context.Context, key string, expirationMinutes int) (string, error)
- func (s *Client) GetS3FileInfo(ctx context.Context, bucket, key string) (*FileInfo, error)
- func (s *Client) ListFiles(ctx context.Context, maxKeys int32) ([]FileInfo, error)
- func (s *Client) Upload(ctx context.Context, file []byte, key string, options ...UploadOptions) (string, error)
- type Config
- type FileInfo
- type S3ReturnType
- type UploadOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseS3URL ¶ added in v1.8.0
ParseS3URL parses an S3 URL and extracts bucket name and key
Types ¶
type Client ¶ added in v1.8.1
type Client struct {
Bucket string
KeyPrefix string
Region string
// contains filtered or unexported fields
}
func (*Client) DeleteFile ¶ added in v1.8.1
DeleteFile deletes a file from S3
func (*Client) FileExists ¶ added in v1.8.1
FileExists checks if a file exists in S3
func (*Client) GeneratePresignedURL ¶ added in v1.8.1
func (s *Client) GeneratePresignedURL(ctx context.Context, key string, expirationMinutes int) (string, error)
GeneratePresignedURL generates a presigned URL for file access
func (*Client) GetS3FileInfo ¶ added in v1.8.1
getFileInfoFromAWS gets file info using AWS SDK (for private URLs)
type FileInfo ¶ added in v1.8.0
type FileInfo struct {
Name string `json:"name"`
Size int64 `json:"size"`
ContentType string `json:"content_type,omitempty"`
LastModified *time.Time `json:"last_modified,omitempty"`
S3Key string `json:"s3_key,omitempty"`
}
FileInfo contains information about a stored file
func GetFileInfoFromHTTP ¶ added in v1.8.4
GetFileInfoFromHTTP gets file info using HTTP HEAD request (for public/signed URLs)
type S3ReturnType ¶ added in v1.8.0
type S3ReturnType string
const ( S3ReturnTypeUrl S3ReturnType = "url" S3ReturnTypePresignedUrl S3ReturnType = "presigned_url" S3ReturnTypeKey S3ReturnType = "key" )
type UploadOptions ¶ added in v1.8.0
Click to show internal directories.
Click to hide internal directories.