Documentation
¶
Index ¶
- Variables
- type AddPathOptions
- type DataNode
- func (d *DataNode) AddData(name string, content []byte)
- func (d *DataNode) AddPath(dir string, opts AddPathOptions) error
- func (d *DataNode) AddSymlink(name, target string)
- func (d *DataNode) CopyFile(sourcePath string, target string, perm os.FileMode) error
- func (d *DataNode) Exists(name string, opts ...ExistsOptions) (bool, error)
- func (d *DataNode) Open(name string) (fs.File, error)
- func (d *DataNode) ReadDir(name string) ([]fs.DirEntry, error)
- func (d *DataNode) Stat(name string) (fs.FileInfo, error)
- func (d *DataNode) ToTar() ([]byte, error)
- func (d *DataNode) ToTarWriter(w io.Writer) error
- func (d *DataNode) Walk(root string, fn fs.WalkDirFunc, opts ...WalkOptions) error
- type ExistsOptions
- type WalkOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidPassword = errors.New("invalid password") ErrPasswordRequired = errors.New("password required") )
Functions ¶
This section is empty.
Types ¶
type AddPathOptions ¶ added in v0.3.0
type AddPathOptions struct {
SkipBrokenSymlinks bool // skip broken symlinks instead of erroring
FollowSymlinks bool // follow symlinks and store target content (default false = store as symlinks)
ExcludePatterns []string // glob patterns to exclude (matched against basename)
}
AddPathOptions configures the behaviour of AddPath.
type DataNode ¶
type DataNode struct {
// contains filtered or unexported fields
}
DataNode is an in-memory filesystem that is compatible with fs.FS.
func (*DataNode) AddPath ¶ added in v0.3.0
func (d *DataNode) AddPath(dir string, opts AddPathOptions) error
AddPath walks a real directory and adds its files to the DataNode. Paths are stored relative to dir, normalized with forward slashes. Directories are implicit and not stored.
func (*DataNode) AddSymlink ¶ added in v0.3.0
AddSymlink adds a symlink entry to the DataNode.
func (*DataNode) Exists ¶
func (d *DataNode) Exists(name string, opts ...ExistsOptions) (bool, error)
Exists returns true if the file or directory exists.
func (*DataNode) ToTarWriter ¶ added in v0.3.0
ToTarWriter streams the DataNode contents to a tar writer. File keys are sorted for deterministic output.
func (*DataNode) Walk ¶
func (d *DataNode) Walk(root string, fn fs.WalkDirFunc, opts ...WalkOptions) error
Walk recursively descends the file tree rooted at root, calling fn for each file or directory.
type ExistsOptions ¶
ExistsOptions allows customizing the Exists check.
Click to show internal directories.
Click to hide internal directories.