filesystem

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileManager

type FileManager struct {
	Err error
	// contains filtered or unexported fields
}
var FileManagerApp FileManager

func (*FileManager) Delete

func (r *FileManager) Delete() error

Delete 删除文件

func (FileManager) New

New 初始化:文件管理

func (FileManager) NewByBytes

func (FileManager) NewByBytes(srcFileBytes []byte, dstDir string, config *FileManagerConfig) *FileManager

NewByBytes 实例化:文件管理器(通过字节)

func (FileManager) NewByLocalFile

func (FileManager) NewByLocalFile(srcDir, dstDir string, config *FileManagerConfig) (*FileManager, error)

NewByLocalFile 初始化:文件管理器(通过本地文件)

func (*FileManager) SetDstDir

func (r *FileManager) SetDstDir(dstDir string) *FileManager

SetDstDir 设置目标目录

func (*FileManager) SetSrcDir

func (r *FileManager) SetSrcDir(srcDir string) (*FileManager, error)

SetSrcDir 设置源文件

func (*FileManager) Upload

func (r *FileManager) Upload() (int64, error)

Upload 上传文件

type FileManagerConfig

type FileManagerConfig struct {
	Username  string
	Password  string
	AuthTitle string
	Driver    FileManagerConfigDriver
}

type FileManagerConfigDriver

type FileManagerConfigDriver = string
const (
	FileManagerConfigDriverLocal FileManagerConfigDriver = "LOCAL"
	FileManagerConfigDriverNexus FileManagerConfigDriver = "NEXUS"
	FileManagerConfigDriverOss   FileManagerConfigDriver = "OSS"
)

type FileSystem

type FileSystem struct {
	IsExist bool
	IsDir   bool
	IsFile  bool
	// contains filtered or unexported fields
}

FileSystem 文件系统

var FileSystemApp FileSystem

func (*FileSystem) CheckPathType

func (r *FileSystem) CheckPathType() error

CheckPathType 判断一个路径是文件还是文件夹

func (*FileSystem) Copy

func (r *FileSystem) Copy() *FileSystem

Copy 复制一个新的对象

func (*FileSystem) CopyDir

func (r *FileSystem) CopyDir(dstDir string, abs bool) error

CopyDir 拷贝目录

func (*FileSystem) CopyFile

func (r *FileSystem) CopyFile(dstDir, dstFilename string, abs bool) error

CopyFile 拷贝单文件

func (FileSystem) CopyFiles

func (FileSystem) CopyFiles(srcFiles []*FileSystemCopyFilesTarget, dstDir string, abs bool) error

CopyFiles 拷贝多个文件

func (*FileSystem) DelDir

func (r *FileSystem) DelDir() error

DelDir 删除文件夹

func (*FileSystem) DelFile

func (r *FileSystem) DelFile() error

DelFile 删除文件

func (*FileSystem) Delete

func (r *FileSystem) Delete() error

Delete 删除文件或文件夹

func (*FileSystem) Exist

func (r *FileSystem) Exist() (bool, error)

Exist 检查文件是否存在

func (FileSystem) GetCurrentPath

func (FileSystem) GetCurrentPath(paths ...string) string

GetCurrentPath 最终方案-全兼容

func (*FileSystem) GetDir

func (r *FileSystem) GetDir() string

GetDir 获取当前路径

func (FileSystem) GetRootPath

func (FileSystem) GetRootPath() string

func (*FileSystem) Join

func (r *FileSystem) Join(dir string) *FileSystem

func (*FileSystem) Joins

func (r *FileSystem) Joins(dir ...string) *FileSystem

Joins 增加若干路径

func (*FileSystem) MkDir

func (r *FileSystem) MkDir() error

MkDir 创建文件夹

func (FileSystem) NewByAbs

func (FileSystem) NewByAbs(dir string) *FileSystem

NewByAbs 实例化:文件系统(绝对路径)

func (FileSystem) NewByRelative

func (FileSystem) NewByRelative(dir string) *FileSystem

NewByRelative 实例化:文件系统(相对路径)

func (*FileSystem) Read

func (r *FileSystem) Read() ([]byte, error)

Read 读取文件

func (*FileSystem) SetDirByAbs

func (r *FileSystem) SetDirByAbs(dir string) *FileSystem

SetDirByAbs 设置路径:绝对路径

func (*FileSystem) SetDirByRelative

func (r *FileSystem) SetDirByRelative(dir string) *FileSystem

SetDirByRelative 设置路径:相对路径

func (*FileSystem) WriteBytes

func (r *FileSystem) WriteBytes(content []byte) (int64, error)

WriteBytes 写入文件:bytes

func (*FileSystem) WriteBytesAppend

func (r *FileSystem) WriteBytesAppend(content []byte) (int64, error)

WriteBytesAppend 追加写入文件:bytes

func (*FileSystem) WriteIoReader

func (r *FileSystem) WriteIoReader(content io.Reader) (written int64, err error)

WriteIoReader 写入文件:io.Reader

func (*FileSystem) WriteIoReaderAppend

func (r *FileSystem) WriteIoReaderAppend(content io.Reader) (int64, error)

WriteIoReaderAppend 追加写入文件:io.Reader

func (*FileSystem) WriteString

func (r *FileSystem) WriteString(content string) (int64, error)

WriteString 写入文件:string

func (*FileSystem) WriteStringAppend

func (r *FileSystem) WriteStringAppend(content string) (int64, error)

WriteStringAppend 追加写入文件:string

type FileSystemCopyFilesTarget

type FileSystemCopyFilesTarget struct {
	Src         *FileSystem
	DstFilename string
}

FileSystemCopyFilesTarget 拷贝文件目标

Jump to

Keyboard shortcuts

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