Documentation
¶
Overview ¶
Package fs provides tools to work with fs.FS
Index ¶
- Variables
- func Clean(path string) (string, bool)
- func Glob(fSys fs.FS, patterns ...string) ([]string, error)
- func Match(fSys fs.FS, root string, globs ...Matcher) ([]string, error)
- func MatchFunc(fSys fs.FS, root string, check func(string, fs.DirEntry) bool) ([]string, error)
- func ReadFile(fSys fs.FS, name string) ([]byte, error)
- func Split(path string) (dir, file string)
- func Stat(fSys fs.FS, name string) (fs.FileInfo, error)
- func ValidPath(name string) bool
- type ChmodFS
- type ChtimesFS
- type ClosedFile
- type Closer
- type DirEntry
- type FS
- type File
- type FileInfo
- type FileMode
- type Flusher
- type GlobFS
- type Matcher
- type MkdirAllFS
- type MkdirFS
- type MkdirTempFS
- type PathError
- type ReadDirFS
- type ReadDirFile
- type ReadFileFS
- type ReadSeeker
- type Reader
- type ReadlinkFS
- type RemoveAllFS
- type RemoveFS
- type RenameFS
- type StatFS
- type SubFS
- type SymlinkFS
- type WriteCloseFlusher
- type WriteFileFS
- type WriteFlusher
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalid is an alias of the standard [fs.ErrInvalid] constant. ErrInvalid = fs.ErrInvalid // ErrPermission is an alias of the standard [fs.ErrPermission] constant. ErrPermission = fs.ErrPermission // ErrExist is an alias of the standard [fs.ErrExist] constant. ErrExist = fs.ErrExist // ErrNotExist is an alias of the standard [fs.ErrNotExist] constant. ErrNotExist = fs.ErrNotExist // ErrClosed is an alias of the standard [fs.ErrClosed] constant. ErrClosed = fs.ErrClosed )
Functions ¶
func Match ¶ added in v0.2.0
Match returns all entries matching any of the given compiled glob patterns.
func MatchFunc ¶ added in v0.2.0
MatchFunc returns all entries satisfying the given checker function. If no function is provided, all entries will be listed. Entries giving Stat error will be ignored.
func ReadFile ¶ added in v0.2.7
ReadFile is a proxy to the standard fs.ReadFile function which attempts to read the content of a file with a given name on the given file system.
func Split ¶ added in v0.1.1
Split splits a path into two Clean fs.ValidPath components that make dir + "/" + file equivalent to the given path.
func Stat ¶ added in v0.2.7
Stat is a proxy to the standard fs.Stat function which attempts to get fs.FileInfo about the given name on the given file system.
func ValidPath ¶
ValidPath is a proxy to the standard fs.ValidPath which reports whether the given path name valid and clean for use in a call to Open().
Types ¶
type ChmodFS ¶ added in v0.2.0
ChmodFS is the interface implemented by a file system that provides the functionality of os.Chmod.
type ChtimesFS ¶ added in v0.2.0
ChtimesFS is the interface implemented by a file system that provides the functionality of os.Chtimes.
type ClosedFile ¶ added in v0.2.2
ClosedFile always returns fs.ErrClosed
func (*ClosedFile) Close ¶ added in v0.2.2
func (*ClosedFile) Close() error
Close implements the fs.File interface, always succeeding as ClosedFile is always closed.
func (*ClosedFile) Read ¶ added in v0.2.2
func (*ClosedFile) Read([]byte) (int, error)
Read implements the io.ReadSeeker interface always returning fs.ErrClosed
func (*ClosedFile) Seek ¶ added in v0.2.2
func (*ClosedFile) Seek(int64, int) (int64, error)
Seek implements the io.ReadSeeker interface always returning fs.ErrClosed
func (*ClosedFile) Stat ¶ added in v0.2.2
func (f *ClosedFile) Stat() (fs.FileInfo, error)
Stat implements the fs.File interface, allowing the return of the original fs.FileInfo, or failing with fs.ErrInvalid if not known.
func (*ClosedFile) Write ¶ added in v0.2.2
func (*ClosedFile) Write([]byte) (int, error)
Write implements the io.Writer interface always returning fs.ErrClosed
type FileMode ¶ added in v0.2.0
FileMode is an alias of the standard fs.FileMode type.
type Flusher ¶ added in v0.2.4
type Flusher interface {
Flush() error
}
A Flusher implements the Flush() error interface to write whatever is left on the buffer.
type Matcher ¶ added in v0.2.0
Matcher is a compiled globbing pattern from https://github.com/gobwas/glob
func GlobCompile ¶
GlobCompile compiles a list of file globbing patterns using https://github.com/gobwas/glob
type MkdirAllFS ¶ added in v0.2.0
MkdirAllFS is the interface implemented by a file system that provides the functionality of os.MkdirAll.
type MkdirFS ¶ added in v0.2.0
MkdirFS is the interface implemented by a file system that provides the functionality of os.Mkdir.
type MkdirTempFS ¶ added in v0.2.0
MkdirTempFS is the interface implemented by a file system that provides the functionality of os.MkdirTemp.
type PathError ¶
PathError is an alias of the standard fs.PathError type.
type ReadDirFS ¶ added in v0.2.0
ReadDirFS is an alias of the standard fs.ReadDirFS type.
type ReadDirFile ¶ added in v0.2.1
type ReadDirFile = fs.ReadDirFile
ReadDirFile is an alias of the standard fs.ReadDirFile interface.
type ReadFileFS ¶ added in v0.2.0
type ReadFileFS = fs.ReadFileFS
ReadFileFS is an alias of the standard fs.ReadFileFS type.
type ReadSeeker ¶ added in v0.2.4
type ReadSeeker = io.ReadSeeker
ReadSeeker is an alias of the standard io.ReadSeeker interface.
type ReadlinkFS ¶ added in v0.2.0
ReadlinkFS is the interface implemented by a file system that provides the functionality of os.Readlink.
type RemoveAllFS ¶ added in v0.2.0
RemoveAllFS is the interface implemented by a file system that provides the functionality of os.RemoveAll.
type RemoveFS ¶ added in v0.2.0
RemoveFS is the interface implemented by a file system that provides the functionality of os.Remove.
type RenameFS ¶ added in v0.2.0
RenameFS is the interface implemented by a file system that provides the functionality of os.Rename.
type SubFS ¶ added in v0.2.0
SubFS is an alias of the standard fs.ReadFileFS type.
type SymlinkFS ¶ added in v0.2.0
SymlinkFS is the interface implemented by a file system that provides the functionality of os.Symlink.
type WriteCloseFlusher ¶ added in v0.2.4
A WriteCloseFlusher implements io.Writer, io.Closer and Flusher.
type WriteFileFS ¶ added in v0.2.0
WriteFileFS is the interface implemented by a file system that provides the functionality of os.WriteFile.
type WriteFlusher ¶ added in v0.2.4
Directories
¶
Path | Synopsis |
---|---|
Package flock provides a wrapper around syscall.Flock
|
Package flock provides a wrapper around syscall.Flock |
Package fssyscall abstracts syscall file descriptors across platform.Handles
|
Package fssyscall abstracts syscall file descriptors across platform.Handles |