| 1 | //go:build js |
| 2 | // +build js |
| 3 | |
| 4 | package osfs |
| 5 | |
| 6 | import ( |
| 7 | "github.com/go-git/go-billy/v5" |
| 8 | "github.com/go-git/go-billy/v5/helper/chroot" |
| 9 | "github.com/go-git/go-billy/v5/memfs" |
| 10 | ) |
| 11 | |
| 12 | // globalMemFs is the global memory fs |
| 13 | var globalMemFs = memfs.New() |
| 14 | |
| 15 | // Default Filesystem representing the root of in-memory filesystem for a |
| 16 | // js/wasm environment. |
| 17 | var Default = memfs.New() |
| 18 | |
| 19 | // New returns a new OS filesystem. |
| 20 | func New(baseDir string, _ ...Option) billy.Filesystem { |
| 21 | return chroot.New(Default, Default.Join("/", baseDir)) |
| 22 | } |
| 23 | |
| 24 | type options struct { |
| 25 | } |