uploader

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const MultipartFormUploadingType = "multipart_form"
View Source
const MultipartPartUploadingType = "multipart_part"

Variables

This section is empty.

Functions

This section is empty.

Types

type MultipartFormUploader

type MultipartFormUploader struct {
	// contains filtered or unexported fields
}

MultipartFormUploader is a service which represents functionality for uploader a full file from *http.Request into storage. This approach of uploading takes a much more RAM but works more fast than MultipartPartUploader. If you care of performance, you need use this approach, but take care of using RAM and set up the appropriate value of 'inMemoryFileSizeThreshold' through env. configuration.

func NewNativeUploader

func NewNativeUploader(
	logger logger.Logger,
	storage storager.Storage,
	filename file.NameComputer,
	formFilename string,
	inMemoryFileSizeThreshold int64,
) *MultipartFormUploader

func (*MultipartFormUploader) Upload

func (u *MultipartFormUploader) Upload(reqDTO dto.UploadResourceRequest) (err error)

Upload method will be store a file on a disk and calculate a new hashed name. Request DTO mutation!

type MultipartPartUploader

type MultipartPartUploader struct {
	// contains filtered or unexported fields
}

MultipartPartUploader - is a file UploadingStrategy which use multipart.Part. In such case it takes more time but takes much less memory. Approximately, to upload a 50MB file you will need only 10MB of RAM.

func NewPartsUploader

func NewPartsUploader(
	logger logger.Logger,
	storage storager.Storage,
	filename file.NameComputer,
) *MultipartPartUploader

func (*MultipartPartUploader) Upload

func (u *MultipartPartUploader) Upload(reqDTO dto.UploadResourceRequest) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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