Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotAppendFS = errors.New("provided filesystem does not implement appendfs.FS interface")
Functions ¶
This section is empty.
Types ¶
type FS ¶
func EnsureFS ¶
EnsureFS checks if the given fsys implements the appendfs.FS interface. The interface requires support for Create and Mkdir in addition to the standard fs.FS methods.
func New ¶
New returns a new appendfs.FS. It wraps an existing fs.FS to ensure it implements the appendfs.FS interface. Primarily used for testing to enforce restricted functionality. If fSys does not implement appendfs.FS, appendfs.ErrNotAppendFS is returned.
func Sub ¶
Sub returns a sub-filesystem starting at the specified path. It returns the new filesystem, an io.Closer, and an error. The io.Closer is important for releasing resources if the underlying filesystem requires it. If the original fsys implements io.Closer, it is returned. Otherwise, a nopCloser is returned so the caller can always safely call Close(). An example of a filesystem that requires a closer is zipasfolder.