github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/pkg/util/filefs/fs.go (about) 1 package filefs 2 3 import ( 4 "io/fs" 5 "os" 6 ) 7 8 type fileFs string 9 10 func New(path string) fs.FS { 11 return fileFs(path) 12 } 13 14 // Open implements fs.FS 15 func (f fileFs) Open(name string) (fs.File, error) { 16 if name == "." { 17 return os.OpenFile(string(f), os.O_RDONLY, os.ModePerm) 18 } else { 19 return nil, os.ErrNotExist 20 } 21 }