fileSaver

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MIT Imports: 10 Imported by: 0

README

fileSaver包用于存储文件 对外暴露Write方法

fileSaver包提供以下驱动

  • 本地文件
  • ftp
  • sftp
  • hdfs
  • ...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Saver

type Saver struct {
	StorageType string `json:"storage_type" yaml:"storage_type" ini:"storage_type"` // 存储类型 local、sftp、ftp、hdfs、miniio等
	// 本地文件系统:/开头,最终路径为/root/path,如果没有/,最终路径是current_path/root/path
	// ftp、sftp:最终生成路径是/userHome/root/path
	Root string `json:"root" yaml:"root" ini:"root"`

	local.Local  `json:"local" yaml:"local" ini:"local"` // 本地文件系统
	SftpConfig   sftp.Config                             `json:"sftp_config" yaml:"sftp_config" ini:"sftp_config"`       // sftp客户端配置
	FtpConfig    ftp.Config                              `json:"ftp_config" yaml:"ftp_config" ini:"ftp_config"`          // ftp客户端配置
	HdfsConfig   hdfs.Config                             `json:"hdfs_config" yaml:"hdfs_config" ini:"hdfs_config"`       // hdfs客户端配置
	MinioConfig  minio.Config                            `json:"minio_config" yaml:"minio_config" ini:"minio_config"`    // minio客户端配置
	MinioOptions minio.Options                           `json:"minio_options" yaml:"minio_options" ini:"minio_options"` // minio客户端配置
}

func (*Saver) Close

func (this *Saver) Close()

Close 关闭资源

func (*Saver) Delete

func (this *Saver) Delete(p string) error

func (*Saver) DeleteAll

func (this *Saver) DeleteAll(p string) error

func (*Saver) ListFiles

func (this *Saver) ListFiles(dirPath string) ([]string, error)

func (*Saver) Read

func (this *Saver) Read(p string) (io.ReadCloser, error)

Read 读取文件

func (*Saver) Write

func (this *Saver) Write(p string, src io.Reader, existIgnores ...bool) (int64, error)

Write 写入文件

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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