xfs

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(content []byte) []byte

Decode Base64编码

func DecodeString

func DecodeString(content string) string

DecodeString Base64编码

func Encode

func Encode(content []byte) string

Encode Base64编码

Types

type File

type File interface {
	afero.File
}

File file fs

type Fs

type Fs interface {
	afero.Fs
}

Fs 文件系统 Interface

type Xfs

type Xfs struct {
	Root string // Root
	afero.Afero
}

Xfs 文件系统

var Stor Xfs

Stor 文件系统实例

func New

func New(path string) Xfs

New 创建文件系统

func NewTar

func NewTar(tarfile string) Xfs

NewTar tar文件系统

func NewZip

func NewZip(zipfile string) Xfs

NewZip 创建Zip文件系统

func (*Xfs) GetTempDir

func (xfs *Xfs) GetTempDir(subPath string) string

GetTempDir 临时目录

func (*Xfs) MustDirExists

func (xfs *Xfs) MustDirExists(dirname string) bool

MustDirExists 检查文件夹是否存在

func (*Xfs) MustExists

func (xfs *Xfs) MustExists(filename string) bool

MustExists 检查文件是否存在

func (*Xfs) MustFileContainsBytes

func (xfs *Xfs) MustFileContainsBytes(filename string, subslice []byte) bool

MustFileContainsBytes 文件是否包含内容

func (*Xfs) MustIsDir

func (xfs *Xfs) MustIsDir(dirname string) bool

MustIsDir 是否为文件夹

func (*Xfs) MustIsEmpty

func (xfs *Xfs) MustIsEmpty(filename string) bool

MustIsEmpty 文件是否为空

func (*Xfs) MustMkdir

func (xfs *Xfs) MustMkdir(dirname string, pterm fs.FileMode)

MustMkdir 创建文件夹

func (*Xfs) MustMkdirAll

func (xfs *Xfs) MustMkdirAll(dirname string, pterm fs.FileMode)

MustMkdirAll 创建文件夹及子文件夹

func (*Xfs) MustOpen

func (xfs *Xfs) MustOpen(filename string) File

MustOpen 打开文件

func (*Xfs) MustReadDir

func (xfs *Xfs) MustReadDir(dirname string) []os.FileInfo

MustReadDir 阅读文件夹内容

func (*Xfs) MustReadFile

func (xfs *Xfs) MustReadFile(filename string) []byte

MustReadFile 阅读文件内容

func (*Xfs) MustSafeWriteReader

func (xfs *Xfs) MustSafeWriteReader(filename string, r io.Reader)

MustSafeWriteReader 检查文件能否写入

func (*Xfs) MustTempDir

func (xfs *Xfs) MustTempDir(dirname string, prefix string) string

MustTempDir 创建临时文件夹

func (*Xfs) MustTempFile

func (xfs *Xfs) MustTempFile(dirname, prefix string) File

MustTempFile 临时文件

func (*Xfs) MustWalk

func (xfs *Xfs) MustWalk(root string, walkFn filepath.WalkFunc)

MustWalk 文件夹遍历

func (*Xfs) MustWriteFile

func (xfs *Xfs) MustWriteFile(filename string, data []byte, perm os.FileMode)

MustWriteFile 写入文件

Jump to

Keyboard shortcuts

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