backends

package
v0.0.0-...-b217fde Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// 2.5 MiB max file size
	MAX_FILE_SIZE = 10 << 18
)

Variables

View Source
var (
	ALLOWED_MIME_TYPES = []string{"image/jpeg", "image/png", "image/gif"}
	FILE_SIZE_UNIT     = math.Pow(1024, 2) // MiB
	FS_UNIT_NAME       = "MiB"
)

Functions

func CheckFile

func CheckFile(handler *multipart.FileHeader, file multipart.File) (marshal.Response, error)

Check if pre-conditions are met for upload

func CopyFileTemp

func CopyFileTemp(w http.ResponseWriter, file multipart.File) (string, error)

func GenUuidFilename

func GenUuidFilename(origFilename string) string

Generate a new filename based on UUID4 + the original file extension

func PutToS3

func PutToS3(errChan chan marshal.Response, multipartFile multipart.File, destFilename string, waitgroup *sync.WaitGroup, idx int)

Upload to S3 bucket

func ReadFile

func ReadFile(filename string) (string, error)

Read file from disk

Types

This section is empty.

Jump to

Keyboard shortcuts

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