Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "io/fs" "github.com/halimath/fsx" "github.com/halimath/fsx/memfs" ) func main() { // Create a fsx.FS using the temp dir. fsys := memfs.New() // Create a file inside the fsys. f, err := fsx.Create(fsys, "test.md") if err != nil { panic(err) } // Write some content to the file. if _, err := f.Write([]byte("# fsx example test\n\nThis is just an example.")); err != nil { panic(err) } if err := f.Close(); err != nil { panic(err) } // Create a symlink inside the fsys if err := fsys.Symlink("test.md", "README.md"); err != nil { panic(err) } // Now try to read the symlinked file using fs.ReadFile content, err := fs.ReadFile(fsys, "README.md") if err != nil { panic(err) } fmt.Println(string(content)) }
Output: # fsx example test This is just an example.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrIsDirectory = errors.New("is a directory")
Functions ¶
Types ¶
type Stat ¶
type Stat struct { // The owners UID. Uid int // The owners GID. Gid int // The time the element was last accessed Atime time.Time // The time the element was last modified. This is identical to the value // returned from fs.FileInfo.ModTime(). Mtime time.Time }
Stat defines a structure that is returned from calls to fs.FileInfo.Sys() for all elements contained in a memfs.
Click to show internal directories.
Click to hide internal directories.