{"modulePath":"github.com/OpenShift/odo","version":"v1.2.6","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package filesystem\n\n## Types\n\n```go\ntype DefaultFs struct{}\n```\nDefaultFs implements Filesystem using same-named functions from \"os\" and \"io/ioutil\"\n\n```go\nfunc (DefaultFs) Chtimes(name string, atime time.Time, mtime time.Time) error\n```\nChtimes via os.Chtimes\n\n```go\nfunc (DefaultFs) Create(name string) (File, error)\n```\nCreate via os.Create\n\n```go\nfunc (DefaultFs) MkdirAll(path string, perm os.FileMode) error\n```\nMkdirAll via os.MkdirAll\n\n```go\nfunc (DefaultFs) Open(name string) (File, error)\n```\nOpen via os.Open\n\n```go\nfunc (DefaultFs) OpenFile(name string, flag int, perm os.FileMode) (File, error)\n```\nOpenFile via os.OpenFile\n\n```go\nfunc (DefaultFs) ReadDir(dirname string) ([]os.FileInfo, error)\n```\nReadDir via ioutil.ReadDir\n\n```go\nfunc (DefaultFs) ReadFile(filename string) ([]byte, error)\n```\nReadFile via ioutil.ReadFile\n\n```go\nfunc (DefaultFs) Remove(name string) error\n```\nRemove via os.RemoveAll\n\n```go\nfunc (DefaultFs) RemoveAll(path string) error\n```\nRemoveAll via os.RemoveAll\n\n```go\nfunc (DefaultFs) Rename(oldpath, newpath string) error\n```\nRename via os.Rename\n\n```go\nfunc (DefaultFs) Stat(name string) (os.FileInfo, error)\n```\nStat via os.Stat\n\n```go\nfunc (DefaultFs) TempDir(dir, prefix string) (string, error)\n```\nTempDir via ioutil.TempDir\n\n```go\nfunc (DefaultFs) TempFile(dir, prefix string) (File, error)\n```\nTempFile via ioutil.TempFile\n\n```go\nfunc (DefaultFs) Walk(root string, walkFn filepath.WalkFunc) error\n```\nWalk via filepath.Walk\n\n```go\nfunc (DefaultFs) WriteFile(filename string, data []byte, perm os.FileMode) error\n```\nWriteFile via ioutil.WriteFile\n\n```go\ntype FSErrorHandler func(err error)\n```\nFSErrorHandler is called when a fsnotify error occurs.\n\n```go\ntype FSEventHandler func(event fsnotify.Event)\n```\nFSEventHandler is called when a fsnotify event occurs.\n\n```go\ntype FSWatcher interface {\n\t// Initializes the watcher with the given watch handlers.\n\t// Called before all other methods.\n\tInit(FSEventHandler, FSErrorHandler) error\n\n\t// Starts listening for events and errors.\n\t// When an event or error occurs, the corresponding handler is called.\n\tRun()\n\n\t// Add a filesystem path to watch\n\tAddWatch(path string) error\n}\n```\nFSWatcher is a callback-based filesystem watcher abstraction for fsnotify.\n\n```go\nfunc NewFsnotifyWatcher() FSWatcher\n```\nNewFsnotifyWatcher returns an implementation of FSWatcher that continuously listens for fsnotify events and calls the event handler as soon as an event is received.\n\n```go\ntype File interface {\n\t// for now, the only os.File methods used are those below, add more as necessary\n\tName() string\n\tWrite(b []byte) (n int, err error)\n\tWriteString(s string) (n int, err error)\n\tSync() error\n\tClose() error\n\tReaddir(n int) ([]os.FileInfo, error)\n}\n```\nFile is an interface that we can use to mock various filesystem operations typically accessed through the File object from the \"os\" package\n\n```go\ntype Filesystem interface {\n\t// from \"os\"\n\tStat(name string) (os.FileInfo, error)\n\tCreate(name string) (File, error)\n\tOpen(name string) (File, error)\n\tOpenFile(name string, flag int, perm os.FileMode) (File, error)\n\tRename(oldpath, newpath string) error\n\tMkdirAll(path string, perm os.FileMode) error\n\tChtimes(name string, atime time.Time, mtime time.Time) error\n\tRemoveAll(path string) error\n\tRemove(name string) error\n\n\t// from \"io/ioutil\"\n\tReadFile(filename string) ([]byte, error)\n\tWriteFile(filename string, data []byte, perm os.FileMode) error\n\tTempDir(dir, prefix string) (string, error)\n\tTempFile(dir, prefix string) (File, error)\n\tReadDir(dirname string) ([]os.FileInfo, error)\n\tWalk(root string, walkFn filepath.WalkFunc) error\n}\n```\nFilesystem is an interface that we can use to mock various filesystem operations\n\n```go\nfunc NewFakeFs() Filesystem\n```\nNewFakeFs returns a fake Filesystem that exists in-memory, useful for unit tests\n\n","path":"github.com/OpenShift/odo/pkg/testingutil/filesystem","name":"filesystem","synopsis":"","isRedistributable":true}
