befiles

package
v0.0.0-...-fe5c0f3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDirectory

func CreateDirectory(path string) grerrors.Error

CreateDirectory create directory with path

func CreateFile

func CreateFile(file string) grerrors.Error

func ForceDeleteDirectory

func ForceDeleteDirectory(name string) grerrors.Error

ForceDeleteDirectory force delete directory with path

func GetFileContentType

func GetFileContentType(out *os.File) (string, error)

GetFileContentType get content type of specified file

Types

type Client

type Client interface {
	StoreFileLocal(file *multipart.FileHeader) (*FileData, grerrors.Error)
	StoreImageBase64Local(data string) (*FileData, grerrors.Error)
	ForceDeleteDirectory(name string) grerrors.Error
	SetMaxFileSize(size int64)
	ConvertFileToBase64(file FileData) (*string, grerrors.Error)
}

func NewClient

func NewClient(rootPath string) (Client, grerrors.Error)

NewClient init new file client

type FileData

type FileData struct {
	Name        string `json:"name"`
	Path        string `json:"path"`
	FullPath    string `json:"full_path"`
	Size        int64  `json:"size"`
	ContentType string `json:"content_type"`
}

func ReadFileInfo

func ReadFileInfo(fullPath string) (*FileData, error)

ReadFileInfo read file info of file in full path

func Unzip

func Unzip(src string, destination string) ([]FileData, error)

Unzip un-zip the file in src to destination path

type ImageType

type ImageType string
const (
	PNG  ImageType = "png"
	JPEG ImageType = "jpeg"
	WEBP ImageType = "webp"
)

Jump to

Keyboard shortcuts

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