Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Opts ¶
type Opts struct {
// Original name of the file to uploaded
InfileName string
// ReadSeeker for the content of the upload
InfileHandle io.ReadSeeker
// Enable gzip compression on the upload
ForceGzip bool
// Set specific mime-type instead of detected from extension
OverrideMimeType string
// Use filename from template
UseCalculatedFilename bool
// BaseURL to reach the uploaded content
BaseURL string
// Template to calculate the uploaded filename from
FileTemplate string
// If set this bar will be provided with the progress
ProgressBar *pb.ProgressBar
// Bucket to upload into
Bucket string
// Endpoint if using MinIO or any other S3-compatible storage
Endpoint string
}
Opts define how the upload works
func (Opts) With ¶
func (o Opts) With(setters ...OptsSetter) Opts
With returns a copy of the original Opts with all setters applied
type OptsSetter ¶
type OptsSetter func(*Opts)
OptsSetter defines a function type to set options
func WithCalculatedFilename ¶
func WithCalculatedFilename(template string) OptsSetter
WithCalculatedFilename enables filename calculation
func WithEndpoint ¶
func WithEndpoint(e string) OptsSetter
WithEndpoint sets a custom endpoint for S3 connection
func WithFile ¶
func WithFile(name string, handle io.ReadSeeker) OptsSetter
WithFile sets the name and handle for the file to upload
func WithMimeType ¶
func WithMimeType(t string) OptsSetter
WithMimeType sets the mime-type for the upload
func WithProgress ¶
func WithProgress() OptsSetter
WithProgress enables progressbar output for the upload
Click to show internal directories.
Click to hide internal directories.