Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// Save stores data under the given filename and returns the URL or path to
// the stored image.
Save(ctx context.Context, data []byte, filename string) (string, error)
}
Backend is the interface implemented by all storage backends.
type LocalBackend ¶
type LocalBackend struct {
// contains filtered or unexported fields
}
LocalBackend saves images to the local filesystem.
func NewLocalBackend ¶ added in v0.2.2
func NewLocalBackend(dir string) *LocalBackend
NewLocalBackend creates a LocalBackend that saves images under dir.
type NodeBBBackend ¶
type NodeBBBackend struct {
// contains filtered or unexported fields
}
NodeBBBackend uploads images to a NodeBB forum instance.
func NewNodeBBBackend ¶
func NewNodeBBBackend(baseURL string) (*NodeBBBackend, error)
NewNodeBBBackend creates a NodeBBBackend for the given base URL.
type R2Backend ¶
type R2Backend struct {
// contains filtered or unexported fields
}
R2Backend uploads images to Cloudflare R2 via the S3-compatible API.
func NewR2Backend ¶
NewR2Backend creates an R2Backend using credentials from environment variables R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY.
Click to show internal directories.
Click to hide internal directories.