Documentation ¶
Overview ¶
Package filesystem - filesystem abstraction
Copyright (c) 2018 Alexey Popov ¶
Permission is hereby granted, free of charge, to any person obtaining a copyAll of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copyAll, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
See more examples on https://github.com/alexeyco/filesystem
Index ¶
- type Dir
- type EachDirHandler
- type EachEntryHandler
- type EachFileHandler
- type Entry
- type ErrAlreadyExist
- type ErrNotDir
- type ErrNotExist
- type ErrNotFile
- type ErrNotInRoot
- type File
- type Fs
- func (fs *Fs) Dir(path string) (*Dir, error)
- func (fs *Fs) Each() *Iterator
- func (fs *Fs) Exist(path string) bool
- func (fs *Fs) File(path string) (*File, error)
- func (fs *Fs) IsDir(path string) bool
- func (fs *Fs) IsFile(path string) bool
- func (fs *Fs) Mkdir(path string) error
- func (fs *Fs) Move(source, dest string) error
- func (fs *Fs) Read(seeker Seeker) Seeker
- func (fs *Fs) Remove(path string) error
- func (fs *Fs) Root() string
- type Iterator
- type Seeker
- type SeekerDeep
- type SeekerIn
- func (s *SeekerIn) Dir(path string) (*Dir, error)
- func (s *SeekerIn) Each() *Iterator
- func (s *SeekerIn) Exist(path string) bool
- func (s *SeekerIn) File(path string) (*File, error)
- func (s *SeekerIn) IsDir(path string) bool
- func (s *SeekerIn) IsFile(path string) bool
- func (s *SeekerIn) Mkdir(path string) error
- func (s *SeekerIn) Move(source, dest string) error
- func (s *SeekerIn) Remove(path string) error
- func (s *SeekerIn) Root() string
- func (s *SeekerIn) SetRoot(root string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EachDirHandler ¶
type EachDirHandler func(dir *Dir)
EachDirHandler directories iteration handler
type EachEntryHandler ¶
type EachEntryHandler func(entry Entry)
EachEntryHandler files iteration handler
type ErrAlreadyExist ¶
type ErrAlreadyExist struct {
// contains filtered or unexported fields
}
ErrAlreadyExist file already exist
type ErrNotDir ¶
type ErrNotDir struct {
// contains filtered or unexported fields
}
ErrNotDir path is not directory
type ErrNotExist ¶
type ErrNotExist struct {
// contains filtered or unexported fields
}
ErrNotExist path is not exist
type ErrNotFile ¶
type ErrNotFile struct {
// contains filtered or unexported fields
}
ErrNotFile path is not file
type ErrNotInRoot ¶
type ErrNotInRoot struct {
// contains filtered or unexported fields
}
ErrNotInRoot path is outside root directory
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs root directory object
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator files iterator
func (*Iterator) Dir ¶
func (i *Iterator) Dir(handler EachDirHandler) error
Dir iterates through directories
func (*Iterator) Entry ¶
func (i *Iterator) Entry(handler EachEntryHandler) error
Entry iterates through files and directories
func (*Iterator) File ¶
func (i *Iterator) File(handler EachFileHandler) error
File iterates through files
type Seeker ¶
type Seeker interface { SetRoot(string) Root() string Each() *Iterator Exist(path string) bool IsDir(path string) bool IsFile(path string) bool Dir(path string) (*Dir, error) File(path string) (*File, error) Mkdir(path string) error Move(source, dest string) error Remove(path string) error // contains filtered or unexported methods }
Seeker file seeker interface
type SeekerDeep ¶
type SeekerDeep struct { *SeekerIn // contains filtered or unexported fields }
SeekerDeep deep file seeker
func (*SeekerDeep) Each ¶
func (s *SeekerDeep) Each() *Iterator
Each returns iterator with current seeker
type SeekerIn ¶
type SeekerIn struct {
// contains filtered or unexported fields
}
SeekerIn basic seeker