file

package
v1.3.50 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Zlib Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyFile added in v1.0.54

func CopyFile(old, new string) error

CopyFile is used to copy a file

func CopyN added in v1.0.59

func CopyN(writer io.Writer, src io.Reader, size int64) (int64, error)

func DirEmpty added in v1.1.11

func DirEmpty(path string) bool

DirEmpty 目录是否为空

func IsDir

func IsDir(f string) int

func IsExist

func IsExist(f string) bool

IsExist 文件或目录

func IsFile

func IsFile(f string) bool

func Open added in v1.1.11

func Open(filename string) (*os.File, int64, error)

func PathPrefix

func PathPrefix(path string) string

func Read added in v1.0.56

func Read(f io.Reader, size int) ([]byte, error)

func ReadFile added in v1.0.56

func ReadFile(f *os.File) ([]byte, error)

func Write added in v1.1.33

func Write(filename string, src io.Reader, perm os.FileMode) error

Types

type Base added in v1.3.45

type Base struct {
	Dir    string
	Key    string
	Bucket string
}

type Chunk added in v1.3.45

type Chunk struct {
	Number int   `json:"number"` // Chunk number
	Offset int64 `json:"offset"` // Chunk offset
	Size   int64 `json:"size"`   // Chunk size.
}

type ChunkResult added in v1.3.45

type ChunkResult struct {
	Key    string  `json:"key,omitempty"`
	Chunks []Chunk `json:"chunks"`
}

type Name added in v1.3.45

type Name struct {
	Base
	Name string
}

Name 文件名

type Path added in v1.3.45

type Path struct {
	Id        string `json:"id"`      //作品ID: vid-nums, 其它id
	Product   string `json:"product"` //产品名
	Biz       string `json:"biz"`     //业务名
	Type      string `json:"type"`    //类型
	Name      string `json:"name"`    //原始文件名
	Ext       string `json:"ext"`
	Md5       string `json:"md5"`
	SaveType  int32  `json:"saveType"`
	ProductId int64  `json:"productId"` //产品
	BizId     int64  `json:"bizId"`     //业务
	Source    int32  `json:"source"`    //`来源
	Size      int64  `json:"size"`
}

type Result added in v1.3.45

type Result struct {
	TaskId   string      `json:"taskId,omitempty"`
	Id       string      `json:"id,omitempty"` //断点续传=UploadId
	Key      string      `json:"key"`
	Url      string      `json:"url"`
	Name     string      `json:"name"`
	Path     string      `json:"-"` //本地文件路径
	SaveType int32       `json:"saveType"`
	Duration int64       `json:"duration"` //豪秒
	Data     interface{} `json:"data,omitempty"`
}

type Results added in v1.3.45

type Results struct {
	Results []Result `json:"results"`
}

type Stream added in v1.3.45

type Stream struct {
	Base
	Seeker io.Seeker
	Reader io.Reader
	Size   int64
}

Stream 文件流

func (*Stream) Seek added in v1.3.45

func (sm *Stream) Seek(offset int64, whence int) (int64, error)

Jump to

Keyboard shortcuts

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