file

package
v0.0.35-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

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

func NewFile

func NewFile(s *structs.AppCtx) *File

func (*File) Download

func (f *File) Download(ctx context.Context, fileID string) ([]byte, error)

func (*File) UploadByBuffer

func (f *File) UploadByBuffer(ctx context.Context, fileName string, buffer []byte, expire time.Duration) (*structs.Attachment, error)

func (*File) UploadByPath

func (f *File) UploadByPath(ctx context.Context, fileName, path string, expire time.Duration) (*structs.Attachment, error)

func (*File) UploadByReader

func (f *File) UploadByReader(ctx context.Context, fileName string, reader io.Reader, expire time.Duration) (*structs.Attachment, error)

type IFile

type IFile interface {
	// UploadByPath 精度是 second, 0 值不过期
	UploadByPath(ctx context.Context, fileName, path string, expire time.Duration) (*structs.Attachment, error)
	// UploadByReader 精度是 second, 0 值不过期
	UploadByReader(ctx context.Context, fileName string, reader io.Reader, expire time.Duration) (*structs.Attachment, error)
	// UploadByBuffer 精度是 second, 0 值不过期
	UploadByBuffer(ctx context.Context, fileName string, buffer []byte, expire time.Duration) (*structs.Attachment, error)
	Download(ctx context.Context, fileID string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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