fs

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SceneNotExist       = errors.New("SceneNotExist")
	ImageTypeNotSupport = errors.New("ImageTypeNotSupport")
	NullPtr             = errors.New("NullPtr")
)

Functions

func CreateScene

func CreateScene(scene string) error

CreateScene 创建场景,存在的不创建

func DeleteImage

func DeleteImage(image *Image) error

func DeleteScene

func DeleteScene(scene string)

DeleteScene 删除场景

func GetDir

func GetDir(scene string) (string, error)

GetDir 获取一个可存放图片路径

func GetScenes

func GetScenes() []string

GetScenes 获取所有场景

func HasScene

func HasScene(scene string) bool

HasScene 判断场景是否存在

func HasSuffix

func HasSuffix(suffix string) bool

HasSuffix 判断是否存在允许图片类型

func OpenFs

func OpenFs(dataPath string, suffixs []string)

func Put

func Put(scene string, filename string, size int64, data []byte) (string, error)

Put 保存文件

Types

type Image

type Image struct {
	Size       int64  `json:"size"`
	FileName   string `json:"fileName"`
	Scene      string `json:"scene"`
	Suffix     string `json:"suffix"`
	Md5        string `json:"md5"`
	Path       string `json:"path"`
	CreateTime int64  `json:"createTime"`
	UpdateTime int64  `json:"updateTime"`
}

Image 图片文件

func Get

func Get(md5 string) (*Image, error)

Get 获取文件信息

func GetImage

func GetImage(md5 string) (*Image, []byte, error)

GetImage 获取文件信息和全部byte

func GetPartImage

func GetPartImage(md5 string, start, end int64) (*Image, []byte, error)

GetPartImage 获取文件信息和部分byte

Jump to

Keyboard shortcuts

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