filer

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(p string) bool

判断文件是否存在

func IsDir added in v0.4.4

func IsDir(p string) bool

判断是否目录

func IsLink(p string) bool

判断是否链接

func Readlink(file string) string

获取软链接的真实路径

func ReleaseEmbedFS added in v0.5.7

func ReleaseEmbedFS(efs embed.FS, root string, args ...string) (string, error)

释放 embed.FS

func Write added in v0.4.1

func Write(file string, data []byte) error

写入文件内容,目录不存在时自动创建

Types

type FileInfo added in v0.3.9

type FileInfo struct {
	Name    string      // 文件名
	Size    int64       // 字节大小
	Mode    os.FileMode // 权限,如 0777
	ModTime int64       // 修改时间,Unix时间戳
	Symlink string      // 链接的真实路径,软链接时有效
	Owner   string      // 所属用户
	Group   string      // 所属组
	IsDir   bool        // 是否是目录
	Data    []byte      // 文件数据
}

func Detail added in v0.4.1

func Detail(file string, read bool) (*FileInfo, error)

获取文件信息和内容

func List

func List(dir string) ([]*FileInfo, error)

列出目录中的所有文件

Jump to

Keyboard shortcuts

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