Packages
Search packages... ⌘K
Go Package
storage
R2-compatible object storage — upload, download, presigned URLs
Go Ready MD
Upload / Download Lifecycle
$ client, _ := storage.NewClient(cfg)
[storage] endpoint: https://account.r2.cloudflarestorage.com
[storage] bucket: shredbx-assets
$ client.Upload(ctx, "images/hero.webp", file)
[upload] images/hero.webp — 245 KB
[upload] complete — etag: "a3f2b9c1"
$ url, _ := client.PresignURL(ctx, "images/hero.webp", 1*time.Hour)
https://assets.shredbx.com/images/hero.webp?X-Amz-Expires=3600&...
About
S3-compatible object storage client optimized for Cloudflare R2. Handles multipart uploads, streaming downloads, and presigned URL generation with configurable expiry and content-type detection.
Public API
| Name | Kind | Signature |
|---|---|---|
| Client | type | type Client struct |
| NewClient | func | func NewClient(cfg Config) (*Client, error) |
| Upload | func | func (c *Client) Upload(ctx context.Context, key string, r io.Reader, opts ...UploadOption) error |
| Download | func | func (c *Client) Download(ctx context.Context, key string) (io.ReadCloser, error) |
| PresignURL | func | func (c *Client) PresignURL(ctx context.Context, key string, expiry time.Duration) (string, error) |
Dependencies
Imports (2)
Related Packages
webassets Go Ready
Image processing pipeline — resize, optimize, format conversion via sips/ImageMagick
imagesresizeoptimizationsipsimagemagick
5 exports 2 deps
config Go Ready
YAML configuration reader — typed config loading with environment overlay
yamlconfigurationenvironmenttyped-config
4 exports 4 deps
Source
github.com/shredbx/sbx-core/pkg/storage
r2s3-compatibleobject-storagepresigned-urls