filer

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(path string) bool

判断文件是否存在

func IsDir added in v0.4.4

func IsDir(path string) bool

判断是否目录

func IsLink(path string) bool

判断是否链接

func Readlink(path string) string

获取软链接的真实路径

func Write added in v0.4.1

func Write(path 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      // 链接的真实路径,软链接时有效
	IsDir   bool        // 是否是目录
	Data    []byte      // 文件数据
}

func Detail added in v0.4.1

func Detail(path 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