Skip to main content

filesys

成员函数函数描述/介绍
filesys.RecursiveRecursive recursively walk through the file system raw: the root path opts: options return: error
filesys.dir
filesys.onDirStatonDirStat will be called when the walker met one directory.
filesys.onFileStatonFileStat will be called when the walker met one file.
filesys.onReadyonReady will be called when the walker is ready to start walking.
filesys.onStatonStat will be called when the walker met one file description.

函数定义#

Recursive#

详细描述#

Recursive recursively walk through the file system

raw: the root path

opts: options

return: error

Example:

err := filesys.Recursive( //
    "testdata",    filesys.dir(["cc", "dd"], filesys.onFileStat((name, info) => {})),
)

定义#

Recursive(raw string, opts ...Option) error

参数#

参数名参数类型参数解释
rawstring
opts...Option

返回值#

返回值(顺序)返回值类型返回值解释
r1error

dir#

详细描述#

定义#

dir(globDir string, opts ...Option) Option

参数#

参数名参数类型参数解释
globDirstring
opts...Option

返回值#

返回值(顺序)返回值类型返回值解释
r1Option

onDirStat#

详细描述#

onDirStat will be called when the walker met one directory.

定义#

onDirStat(h func(pathname string, info os.FileInfo)) Option

参数#

参数名参数类型参数解释
hfunc(pathname string, info os.FileInfo)

返回值#

返回值(顺序)返回值类型返回值解释
r1Option

onFileStat#

详细描述#

onFileStat will be called when the walker met one file.

定义#

onFileStat(h func(pathname string, info os.FileInfo)) Option

参数#

参数名参数类型参数解释
hfunc(pathname string, info os.FileInfo)

返回值#

返回值(顺序)返回值类型返回值解释
r1Option

onReady#

详细描述#

onReady will be called when the walker is ready to start walking.

定义#

onReady(h func(name string, isDir bool)) Option

参数#

参数名参数类型参数解释
hfunc(name string, isDir bool)

返回值#

返回值(顺序)返回值类型返回值解释
r1Option

onStat#

详细描述#

onStat will be called when the walker met one file description.

定义#

onStat(h func(isDir bool, pathname string, info os.FileInfo)) Option

参数#

参数名参数类型参数解释
hfunc(isDir bool, pathname string, info os.FileInfo)

返回值#

返回值(顺序)返回值类型返回值解释
r1Option