filesys
函数名 | 函数描述/介绍 |
---|---|
filesys.Recursive | Recursive recursively walk through the file system raw: the root path opts: options return: error |
filesys.dir | |
filesys.onDirStat | onDirStat will be called when the walker met one directory. |
filesys.onFileStat | onFileStat will be called when the walker met one file. |
filesys.onReady | onReady will be called when the walker is ready to start walking. |
filesys.onStat | onStat 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
#
参数参数名 | 参数类型 | 参数解释 |
---|---|---|
raw | string | |
opts | ...Option |
#
返回值返回值(顺序) | 返回值类型 | 返回值解释 |
---|---|---|
r1 | error |
#
dir#
详细描述#
定义dir(globDir string, opts ...Option) Option
#
参数参数名 | 参数类型 | 参数解释 |
---|---|---|
globDir | string | |
opts | ...Option |
#
返回值返回值(顺序) | 返回值类型 | 返回值解释 |
---|---|---|
r1 | Option |
#
onDirStat#
详细描述onDirStat will be called when the walker met one directory.
#
定义onDirStat(h func(pathname string, info os.FileInfo)) Option
#
参数参数名 | 参数类型 | 参数解释 |
---|---|---|
h | func(pathname string, info os.FileInfo) |
#
返回值返回值(顺序) | 返回值类型 | 返回值解释 |
---|---|---|
r1 | Option |
#
onFileStat#
详细描述onFileStat will be called when the walker met one file.
#
定义onFileStat(h func(pathname string, info os.FileInfo)) Option
#
参数参数名 | 参数类型 | 参数解释 |
---|---|---|
h | func(pathname string, info os.FileInfo) |
#
返回值返回值(顺序) | 返回值类型 | 返回值解释 |
---|---|---|
r1 | Option |
#
onReady#
详细描述onReady will be called when the walker is ready to start walking.
#
定义onReady(h func(name string, isDir bool)) Option
#
参数参数名 | 参数类型 | 参数解释 |
---|---|---|
h | func(name string, isDir bool) |
#
返回值返回值(顺序) | 返回值类型 | 返回值解释 |
---|---|---|
r1 | Option |
#
onStat#
详细描述onStat will be called when the walker met one file description.
#
定义onStat(h func(isDir bool, pathname string, info os.FileInfo)) Option
#
参数参数名 | 参数类型 | 参数解释 |
---|---|---|
h | func(isDir bool, pathname string, info os.FileInfo) |
#
返回值返回值(顺序) | 返回值类型 | 返回值解释 |
---|---|---|
r1 | Option |