s3util

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBucketKey

func GetBucketKey(s3Path string) (string, string, error)

GetBucketKey extracts the bucket name and key from an S3 path

func GetObjectContent

func GetObjectContent(ctx context.Context, bucketName, key string) ([]byte, error)

GetObjectContent fetches an object from S3 and returns its content as bytes

func GetPresignedDownloadURL

func GetPresignedDownloadURL(ctx context.Context, bucketName, key string, expires time.Duration) (string, error)

GetPresignedDownloadURL generates a presigned GET URL for downloading an object. The signer only mints the URL; the actual read happens client-side under the caller's existing `s3:GetObject` permission, so no separate read path is required. The URL is scoped to this single object and valid for `expires`.

func GetPresignedURL

func GetPresignedURL(ctx context.Context, bucketName, key string, expires time.Duration, overwrite bool) (string, error)

GetPresignedURL generates a presigned URL for the given operation

func GetS3Path

func GetS3Path(bucketName, key string) string

func ListBuckets

func ListBuckets() ([]string, error)

func PutObject

func PutObject(ctx context.Context, bucketName, key string, body io.Reader) error

func PutObjectWithHeaders

func PutObjectWithHeaders(ctx context.Context, bucketName, key string, body io.Reader, contentType, cacheControl string) error

PutObjectWithHeaders writes an object with Content-Type and Cache-Control set; empty values are omitted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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