Documentation ¶
Index ¶
- Constants
- func Symlinkat(cwd, file, linkTo string) error
- type CwdGetFunc
- type FindOp
- type FindOptions
- type OSFS
- func (ofs *OSFS) Abs(name string) (path string, err error)
- func (ofs *OSFS) Chmod(name string, mode fs.FileMode) error
- func (ofs *OSFS) Chown(name string, uid, gid int) error
- func (ofs *OSFS) Chtimes(name string, atime time.Time, mtime time.Time) error
- func (ofs *OSFS) Create(name string) (fs.File, error)
- func (ofs *OSFS) Find(fopts *FindOptions, startpath string) (ret []string, err error)
- func (ofs *OSFS) Glob(pattern string) ([]string, error)
- func (ofs *OSFS) Lstat(name string) (fs.FileInfo, error)
- func (ofs *OSFS) Mkdir(name string, perm fs.FileMode) error
- func (ofs *OSFS) MkdirAll(name string, perm fs.FileMode) error
- func (ofs *OSFS) Open(name string) (fs.File, error)
- func (ofs *OSFS) OpenFile(name string, flag int, perm fs.FileMode) (fs.File, error)
- func (ofs *OSFS) ReadDir(name string) ([]fs.DirEntry, error)
- func (ofs *OSFS) ReadFile(name string) ([]byte, error)
- func (ofs *OSFS) Readlink(name string) (string, error)
- func (ofs *OSFS) Remove(name string) error
- func (ofs *OSFS) RemoveAll(name string) error
- func (ofs *OSFS) Rename(oldname, newname string) error
- func (ofs *OSFS) Stat(name string) (fs.FileInfo, error)
- func (ofs *OSFS) Sub(dir string) (fs.FS, error)
- func (ofs *OSFS) Symlink(oldname, newname string) error
- func (ofs *OSFS) TryMatch(opts *FindOptions, slashPath string, d fs.DirEntry) (matched bool, err error)
- func (ofs *OSFS) WriteFile(name string, data []byte, perm fs.FileMode) error
- type Op
Constants ¶
View Source
const (
SYS_Statx = 332
)
Variables ¶
This section is empty.
Functions ¶
func Symlinkat ¶
Symlinkat creates symlink relative to cwd rather actual working dir ref: https://man7.org/linux/man-pages/man2/symlink.2.html
Types ¶
type CwdGetFunc ¶ added in v0.10.0
op and name are operation and path value triggered this func, return value is the absolute path of current working dir
when operation involves more than one path value (e.g. Op_Symlink), name is the old path value
type FindOp ¶ added in v0.10.0
type FindOp uint32
FindOp is the bitset of find operations
const ( FindOp_CheckDepth FindOp = 1 << iota // set FindOptions.FileType to filter FindOp_CheckTypeNotFile // not regular file (e.g. dir, symlink) // FindOptions.FileType is ignored, and file should report is regular file FindOp_CheckTypeIsFile // is regular file FindOp_CheckPerm // TODO: currently not implementd // set both FindOptions.{Min, Max}Size to filter FindOp_CheckSize FindOp_CheckUserInvalid // no unix implementation // set FindOptions.UnixUID or FindOptions.WindowsOrPlan9User to filter FindOp_CheckUser // set FindOptions.UnixGID or FindOptions.WindowsOrPlan9Group to filter FindOp_CheckGroup // set both FindOptions.{Min, Max}CreationTime to filter FindOp_CheckCreationTime // btime (birth time) // set both FindOptions.{Min, Max}Ctime to filter FindOp_CheckLastMetadataChangeTime // ctime // set both FindOptions.{Min, Max}Atime to filter FindOp_CheckLastAccessTime // atime // set both FindOptions.{Min, Max}Mtime to filter FindOp_CheckLastContentUpdatedTime // mtime // set FindOptions.NamePattern to filter FindOp_CheckName // set FindOptions.NamePatternFollowSymlink to filter FindOp_CheckNameFollowSymlink // set FindOptions.NamePatternLower to filter FindOp_CheckNameIgnoreCase // set FindOptions.NamePatternLowerFollowSymlink to filter FindOp_CheckNameIgnoreCaseFollowSymlink // set FindOptions.PathPattern to filter FindOp_CheckPath // set FindOptions.PathPatternLower to filter FindOp_CheckPathIgnoreCase // set FindOptions.RegExpr to filter FindOp_CheckRegex // set FindOptions.RegExprNoCase to filter FindOp_CheckRegexNoCase )
type FindOptions ¶ added in v0.10.0
type FindOptions struct { Ops FindOp FileType fs.FileMode Perm fs.FileMode // TODO: currently not used MinDepth, MaxDepth int32 MinSize, MaxSize int64 // unix timestamps (seconds since unix epoch) MinCreationTime, MaxCreationTime int64 MinAtime, MaxAtime int64 MinCtime, MaxCtime int64 MinMtime, MaxMtime int64 RegExpr, RegExprNoCase regexp.Regexp UnixUID, UnixGID uint32 // windows SID of user & group or plan9 user & group name WindowsOrPlan9User, WindowsOrPlan9Group string PathPattern, PathPatternLower string NamePattern, NamePatternFollowSymlink, NamePatternLower, NamePatternLowerFollowSymlink string // Run on each matched path OnMatch func(path string, d fs.DirEntry) }
type OSFS ¶
type OSFS struct { // Strict when set to true, adhere to io/fs.FS path value requirements // otherwise accepts all system path values Strict bool // used to determine current working dir, the string return value should be valid system // file path GetCwd CwdGetFunc // LookupFHS is the custom handler for unix style path on windows LookupFHS func(string) (string, error) }
OSFS is a context aware filesystem abstration for afero.FS and io/fs.FS
func NewOSFS ¶
func NewOSFS(strictIOFS bool, getCwd CwdGetFunc) *OSFS
NewOSFS creates a new filesystem abstraction for real filesystem set strictIOFS to true to only allow fs path value
getCwd is
func (*OSFS) Find ¶ added in v0.10.0
func (ofs *OSFS) Find(fopts *FindOptions, startpath string) (ret []string, err error)
Find all matched files by walking from startpath
type Op ¶ added in v0.10.0
type Op uint32
const ( Op_Unknown Op = iota Op_Abs // operation to get absolute path Op_Sub // operation to create sub fs Op_Create // operation to create file Op_Symlink // operation to create symlink Op_Mkdir // operation to create dir Op_MkdirAll // operation to create dir recursively Op_OpenFile // operation to open file with options Op_Open // operation to open file for reading Op_Lstat // operation to lstat Op_Stat // operation to stat Op_ReadFile // operation to read file content Op_ReadDir // operation to read dir file list Op_Readlink // operation to read link destination Op_WriteFile // operation to write content to file Op_Chmod // operation to change permission flags of file Op_Chown // operation to change owner flags of file Op_Chtimes // operation to change time values of file Op_Rename // operation to rename file Op_Remove // operation to remove file Op_RemoveAll // operation to remove files recursively )
Click to show internal directories.
Click to hide internal directories.