Documentation ¶
Index ¶
- Constants
- func Abs(path string) (string, error)
- func AddMimeType(ext string, mime string)
- func AllFiles(directory string) ([]string, error)
- func Append(path string, data string) error
- func Basename(path string) string
- func Chmod(path string, mode uint32) error
- func Clean(path string) string
- func CleanDirectory(directory string) error
- func Close(fd *os.File) error
- func Copy(path string, target string) error
- func CopyDirectory(directory string, destination string) error
- func Create(name string) (*os.File, error)
- func Delete(path string) error
- func DeleteDirectories(directory string) bool
- func DeleteDirectory(directory string, preserve ...bool) error
- func Directories(directory string) ([]string, error)
- func Dirname(path string) string
- func EnsureDirectoryExists(directory string, mode uint32, recursive ...bool) error
- func EvalSymlinks(path string) (string, error)
- func Exists(path string) bool
- func Extension(path string) string
- func Files(directory string) ([]string, error)
- func FormatSize(size int64) string
- func FromSlash(s string) string
- func Get(path string, lock ...bool) (string, error)
- func GetMimeExtension(mime string) string
- func GetMimeType(extension string) string
- func Glob(pattern string) ([]string, error)
- func GuessExtension(path string) string
- func Hash(path string) (string, error)
- func IsAbs(path string) bool
- func IsDirectory(path string) bool
- func IsFile(path string) bool
- func IsReadable(path string) bool
- func IsSymlink(m os.FileMode) bool
- func IsWritable(path string) bool
- func Join(elem ...string) string
- func LastModified(path string) int64
- func Lines(path string) ([]string, error)
- func Link(target string, link string) error
- func MakeDirectory(directory string, mode uint32, recursive ...bool) error
- func Match(pattern, name string) (bool, error)
- func MimeType(path string) string
- func Missing(path string) bool
- func Move(path string, target string) error
- func MoveDirectory(from string, to string, overwrite ...bool) error
- func Name(path string) string
- func Perm(path string) (uint32, error)
- func PermIntString(path string) (string, error)
- func PermString(path string) (string, error)
- func Prepend(path string, data string) error
- func Put(path string, contents string, lock ...bool) error
- func Readlink(path string) (string, error)
- func Realpath(path string) (string, error)
- func Rel(basepath, targpath string) (string, error)
- func Rename(path string, target string) error
- func Replace(path string, contents string) error
- func ReplaceInFile(search string, replace string, path string) error
- func SharedGet(path string) (string, error)
- func Size(path string) int64
- func Split(path string) (string, string)
- func SplitList(path string) []string
- func ToSlash(s string) string
- func Touch(filename string) error
- func Type(path string) string
- type FileInfo
- type FileMode
- type Filesystem
- func (this *Filesystem) Abs(path string) (string, error)
- func (this *Filesystem) AllFiles(directory string) ([]string, error)
- func (this *Filesystem) Append(path string, data string) error
- func (this *Filesystem) Basename(path string) string
- func (this *Filesystem) Chmod(path string, mode uint32) error
- func (this *Filesystem) Clean(path string) string
- func (this *Filesystem) CleanDirectory(directory string) error
- func (this *Filesystem) Close(fd *os.File) error
- func (this *Filesystem) Copy(path string, target string) error
- func (this *Filesystem) CopyDirectory(directory string, destination string) error
- func (this *Filesystem) Create(name string) (*os.File, error)
- func (this *Filesystem) Delete(path string) error
- func (this *Filesystem) DeleteDirectories(directory string) bool
- func (this *Filesystem) DeleteDirectory(directory string, preserve ...bool) error
- func (this *Filesystem) Directories(directory string) ([]string, error)
- func (this *Filesystem) Dirname(path string) string
- func (this *Filesystem) EnsureDirectoryExists(directory string, mode uint32, recursive ...bool) error
- func (this *Filesystem) EvalSymlinks(path string) (string, error)
- func (this *Filesystem) Exists(path string) bool
- func (this *Filesystem) Extension(path string) string
- func (this *Filesystem) Files(directory string) ([]string, error)
- func (this *Filesystem) FromSlash(s string) string
- func (this *Filesystem) Get(path string, lock ...bool) (string, error)
- func (this *Filesystem) Glob(pattern string) ([]string, error)
- func (this *Filesystem) GuessExtension(path string) string
- func (this *Filesystem) Hash(path string) (string, error)
- func (this *Filesystem) IsAbs(path string) bool
- func (this *Filesystem) IsDirectory(path string) bool
- func (this *Filesystem) IsFile(path string) bool
- func (this *Filesystem) IsReadable(path string) bool
- func (this *Filesystem) IsSymlink(m os.FileMode) bool
- func (this *Filesystem) IsWritable(path string) bool
- func (this *Filesystem) Join(elem ...string) string
- func (this *Filesystem) LastModified(path string) int64
- func (this *Filesystem) Lines(path string) ([]string, error)
- func (this *Filesystem) Link(target string, link string) error
- func (this *Filesystem) MakeDirectory(directory string, mode uint32, recursive ...bool) error
- func (this *Filesystem) Match(pattern, name string) (bool, error)
- func (this *Filesystem) MimeType(path string) string
- func (this *Filesystem) Missing(path string) bool
- func (this *Filesystem) Move(path string, target string) error
- func (this *Filesystem) MoveDirectory(from string, to string, overwrite ...bool) error
- func (this *Filesystem) Name(path string) string
- func (this *Filesystem) Perm(path string) (uint32, error)
- func (this *Filesystem) PermIntString(path string) (string, error)
- func (this *Filesystem) PermString(path string) (string, error)
- func (this *Filesystem) Prepend(path string, data string) error
- func (this *Filesystem) Put(path string, contents string, lock ...bool) error
- func (this *Filesystem) Readlink(path string) (string, error)
- func (this *Filesystem) Realpath(path string) (string, error)
- func (this *Filesystem) Rel(basepath, targpath string) (string, error)
- func (this *Filesystem) Rename(path string, target string) error
- func (this *Filesystem) Replace(path string, contents string) error
- func (this *Filesystem) ReplaceInFile(search string, replace string, path string) error
- func (this *Filesystem) SharedGet(path string) (string, error)
- func (this *Filesystem) Size(path string) int64
- func (this *Filesystem) Split(path string) (string, string)
- func (this *Filesystem) SplitList(path string) []string
- func (this *Filesystem) ToSlash(s string) string
- func (this *Filesystem) Touch(filename string) error
- func (this *Filesystem) Type(path string) string
Constants ¶
View Source
const ( ModeDir = os.ModeDir // d: is a directory ModeAppend = os.ModeAppend // a: append-only ModeExclusive = os.ModeExclusive // l: exclusive use ModeTemporary = os.ModeTemporary // T: temporary file; Plan 9 only ModeSymlink = os.ModeSymlink // L: symbolic link ModeDevice = os.ModeDevice // D: device file ModeNamedPipe = os.ModeNamedPipe // p: named pipe (FIFO) ModeSocket = os.ModeSocket // S: Unix domain socket ModeSetuid = os.ModeSetuid // u: setuid ModeSetgid = os.ModeSetgid // g: setgid ModeCharDevice = os.ModeCharDevice // c: Unix character device, when ModeDevice is set ModeSticky = os.ModeSticky // t: sticky ModeIrregular = os.ModeIrregular // ?: non-regular file; nothing else is known about this file // Mask for the type bits. For regular files, none will be set. ModeType = os.ModeType // Unix permission bits, 0o777 ModePerm = os.ModePerm )
View Source
const ( // 只读模式 O_RDONLY int = os.O_RDONLY // 只写模式 O_WRONLY int = os.O_WRONLY // 可读可写 O_RDWR int = os.O_RDWR // 追加内容 O_APPEND int = os.O_APPEND // 创建文件,如果文件不存在 O_CREATE int = os.O_CREATE // 与创建文件一同使用,文件必须存在 O_EXCL int = os.O_EXCL // 打开一个同步的文件流 O_SYNC int = os.O_SYNC // 如果可能,打开时缩短文件 O_TRUNC int = os.O_TRUNC )
Flags 列表
Variables ¶
This section is empty.
Functions ¶
func CopyDirectory ¶ added in v1.0.1003
复制文件夹
func DeleteDirectory ¶ added in v1.0.1003
删除文件夹
func EnsureDirectoryExists ¶ added in v1.0.1003
创建文件夹
func MakeDirectory ¶ added in v1.0.1003
创建文件夹
func MoveDirectory ¶ added in v1.0.1003
移动文件夹
func ReplaceInFile ¶ added in v1.0.1003
替换
Types ¶
type Filesystem ¶
type Filesystem struct{}
*
- 本地文件管理器 *
- @create 2022-2-27
- @author deatil
func (*Filesystem) AllFiles ¶
func (this *Filesystem) AllFiles(directory string) ([]string, error)
全部文件
func (*Filesystem) CleanDirectory ¶
func (this *Filesystem) CleanDirectory(directory string) error
清空文件夹
func (*Filesystem) CopyDirectory ¶
func (this *Filesystem) CopyDirectory(directory string, destination string) error
复制文件夹
func (*Filesystem) DeleteDirectories ¶
func (this *Filesystem) DeleteDirectories(directory string) bool
删除文件夹
func (*Filesystem) DeleteDirectory ¶
func (this *Filesystem) DeleteDirectory(directory string, preserve ...bool) error
删除文件夹
func (*Filesystem) Directories ¶
func (this *Filesystem) Directories(directory string) ([]string, error)
列出文件夹
func (*Filesystem) EnsureDirectoryExists ¶
func (this *Filesystem) EnsureDirectoryExists( directory string, mode uint32, recursive ...bool, ) error
创建文件夹
func (*Filesystem) EvalSymlinks ¶
func (this *Filesystem) EvalSymlinks(path string) (string, error)
读取软链接的原始地址
func (*Filesystem) FromSlash ¶
func (this *Filesystem) FromSlash(s string) string
将 path 中的 ‘/’ 转换为系统相关的路径分隔符
func (*Filesystem) Get ¶
func (this *Filesystem) Get(path string, lock ...bool) (string, error)
获取数据
func (*Filesystem) Join ¶
func (this *Filesystem) Join(elem ...string) string
函数可以将任意数量的路径元素放入一个单一路径里,会根据需要添加路径分隔符
func (*Filesystem) MakeDirectory ¶
func (this *Filesystem) MakeDirectory( directory string, mode uint32, recursive ...bool, ) error
创建文件夹
func (*Filesystem) MoveDirectory ¶
func (this *Filesystem) MoveDirectory( from string, to string, overwrite ...bool, ) error
移动文件夹
func (*Filesystem) PermIntString ¶ added in v1.0.1007
func (this *Filesystem) PermIntString(path string) (string, error)
权限数字转为字符
func (*Filesystem) PermString ¶
func (this *Filesystem) PermString(path string) (string, error)
获取权限 - 字符
func (*Filesystem) Put ¶
func (this *Filesystem) Put(path string, contents string, lock ...bool) error
添加数据
func (*Filesystem) Readlink ¶
func (this *Filesystem) Readlink(path string) (string, error)
读取软链接于原始路径的相对地址
func (*Filesystem) Rel ¶
func (this *Filesystem) Rel(basepath, targpath string) (string, error)
返回一个相对路径
func (*Filesystem) Rename ¶ added in v1.0.1007
func (this *Filesystem) Rename(path string, target string) error
重命名
func (*Filesystem) ReplaceInFile ¶
func (this *Filesystem) ReplaceInFile(search string, replace string, path string) error
替换
func (*Filesystem) Split ¶
func (this *Filesystem) Split(path string) (string, string)
函数根据最后一个路径分隔符将路径 path 分隔为目录和文件名两部分(dir 和 file)
func (*Filesystem) SplitList ¶
func (this *Filesystem) SplitList(path string) []string
分割 PATH 或 GOPATH 之类的环境变量
func (*Filesystem) ToSlash ¶
func (this *Filesystem) ToSlash(s string) string
将 path 中平台相关的路径分隔符转换为 ‘/’
Click to show internal directories.
Click to hide internal directories.