fileserver

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFileDownloader

func RegisterFileDownloader(route gin.IRouter, storage storage.Storage, options ...DownloaderOption)

func RegisterFormFileUploader

func RegisterFormFileUploader(route gin.IRouter, storage storage.Storage, keyBuilder FileKeyBuilder, options ...UploadOption)

Types

type Config

type Config struct {
	PublicBase string `json:"public_base" yaml:"public_base"`
	PutPrefix  string `json:"put_prefix" yaml:"put_prefix"`
}

type DownloaderOption

type DownloaderOption func(o *downloaderOptions)

func WithCacheControl

func WithCacheControl(maxAge uint64) DownloaderOption

type FileKeyBuilder

type FileKeyBuilder func(ctx *gin.Context, filename string) string

type S3Adapter

type S3Adapter struct {
	storage.Storage
	// contains filtered or unexported fields
}

func NewS3Adapter

func NewS3Adapter(config *Config, cache cache.ByteCache, store storage.Storage) *S3Adapter

func (*S3Adapter) GenerateUploadToken

func (a *S3Adapter) GenerateUploadToken(ctx context.Context, fileName string, dir string, nameBuilder func(filename string, dir ...string) string) ([3]string, error)

func (*S3Adapter) RegisterFileDownloader

func (a *S3Adapter) RegisterFileDownloader(route gin.IRouter, options ...DownloaderOption)

func (*S3Adapter) RegisterPutFileUploader

func (a *S3Adapter) RegisterPutFileUploader(route gin.IRouter, options ...UploadOption)

type UploadOption

type UploadOption func(*uploadOptions)

Jump to

Keyboard shortcuts

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