Documentation
¶
Index ¶
- func Flags(flags int) jsfs.OFOption
- type FS
- func (s *FS) Mkdir(name string, perm fs.FileMode) error
- func (s *FS) MkdirAll(path string, perm fs.FileMode) error
- func (s *FS) Open(name string) (fs.File, error)
- func (s *FS) OpenFile(name string, perms fs.FileMode, options ...jsfs.OFOption) (fs.File, error)
- func (s *FS) RO()
- func (s *FS) ReadDir(name string) ([]fs.DirEntry, error)
- func (s *FS) ReadFile(name string) ([]byte, error)
- func (s *FS) Remove(name string) error
- func (s *FS) RemoveAll(path string) error
- func (s *FS) Stat(name string) (fs.FileInfo, error)
- func (s *FS) WriteFile(name string, content []byte, perm fs.FileMode) error
- type SimpleOption
- type WRFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
FS provides a simple memory structure that implements io/fs.FS and fs.Writer(above). This is great for aggregating several different embeded fs.FS into a single structure using Merge() below. It uses "/" unix separators and doesn't deal with any funky "\/" things. If you want to use this don't start trying to get complicated with your pathing. This structure is safe for concurrent reading or concurrent writing, but not concurrent read/write. Once finished writing files, you should call .RO() to lock it.
func (*FS) Mkdir ¶
Mkdir provides a no-op Mkdir for FS. Directories are only made when files are written to them. But this allows for calls by code that can be swapped with an os FS to function.
func (*FS) MkdirAll ¶
MkdirAll provides a no-op MkdirAll for FS. Directories are only made when files are written to them. But this allows for calls by code that can be swapped with an os FS to function.
func (*FS) OpenFile ¶
OpenFile implements OpenFiler. Supports flags O_RDONLY, O_WRONLY, O_CREATE, O_TRUNC and O_EXCL. The file returned by OpenFile is not thread-safe.
func (*FS) ReadFile ¶
ReadFile implememnts ReadFileFS.ReadFile(). The slice returned by ReadFile is not a copy of the file's contents like Open().File.Read() returns. Modifying it will modifiy the content so BE CAREFUL.
func (*FS) Remove ¶
Remove removes the named file or (empty) directory. If there is an error, it will be of type *PathError.
func (*FS) RemoveAll ¶
RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, RemoveAll returns nil (no error). If there is an error, it will be of type *fs.PathError.
type SimpleOption ¶
type SimpleOption func(s *FS)
SimpleOption provides an optional argument to NewSimple().
func WithPearson ¶
func WithPearson() SimpleOption
WithPearson will create a lookup cache using Pearson hashing to make lookups actually happen at O(1) (after the hash calc) instead of walking the file system tree after various strings splits. When using this, realize that you MUST be using ASCII characters.