file

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(path string) error

Delete 文件夹/文件通用删除方法

func GetPerm

func GetPerm(path string) error

GetPerm 获取win管理员(admin)权限

Types

type File

type File struct {
	//文件名(包含后缀)
	Name string
	//文件大小
	Size int64
	//创建时间
	CreateTime time.Time

	//文件后缀
	Ext string
	//完整路径
	Path string

	//修改时间
	ModifyTime time.Time
	//文件是否被隐藏(window)
	IsHidden   bool
	IsCanRead  bool
	IsCanWrite bool
}

func OpenFile

func OpenFile(path string) (*File, error)

OpenFile 打开文件 返回文件以及错误信息

func (*File) Content

func (f *File) Content(fn func(bs []byte) *[]byte) error

Content 获取内容,返回[]byte指针则修改源文件内容

func (*File) Delete

func (f *File) Delete() error

Delete 删除文件

func (*File) SetHiddenAtt

func (f *File) SetHiddenAtt(ishidden bool) error

SetHiddenAtt 设置隐藏属性

func (*File) ToHash

func (f *File) ToHash() (string, error)

ToHash 获取哈希值

Jump to

Keyboard shortcuts

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