Documentation
¶
Overview ¶
Package vfsbilly provides a compatibility layer between github.com/twpayne/go-vfs and github.com/go-git/go-billy.
Index ¶
- type BillyFS
- func (b *BillyFS) Capabilities() billy.Capability
- func (b *BillyFS) Chroot(path string) (billy.Filesystem, error)
- func (b *BillyFS) Create(filename string) (billy.File, error)
- func (b *BillyFS) Join(elem ...string) string
- func (b *BillyFS) MkdirAll(filename string, perm os.FileMode) error
- func (b *BillyFS) Open(filename string) (billy.File, error)
- func (b *BillyFS) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)
- func (b *BillyFS) Root() string
- func (b *BillyFS) TempFile(dir, prefix string) (billy.File, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BillyFS ¶
A BillyFS implements github.com/go-git/go-billy.Filesystem.
func NewBillyFS ¶
NewBillyFS returns a new BillyFS.
Example ¶
package main
import (
"testing"
billyutil "github.com/go-git/go-billy/v5/util"
"github.com/twpayne/go-vfs/vfst"
vfsbilly "github.com/twpayne/go-vfsbilly"
)
func main() {
Test := func(t *testing.T) {
fs, cleanup, err := vfst.NewTestFS(map[string]interface{}{
"/home/user/.bashrc": "# contents of .bashrc\n",
})
if err != nil {
t.Fatal(err)
}
defer cleanup()
billyFS := vfsbilly.NewBillyFS(fs)
if err := billyutil.WriteFile(billyFS, "/home/user/foo", []byte("bar"), 0o666); err != nil {
t.Errorf("billyutil.WriteFile(...) == %v, want <nil>", err)
}
vfst.RunTests(t, fs, "",
vfst.TestPath("/home/user/foo",
vfst.TestContentsString("bar"),
),
)
}
Test(&testing.T{})
}
Output:
func (*BillyFS) Capabilities ¶
func (b *BillyFS) Capabilities() billy.Capability
Capabilities implements billy.Filesystem.Capabilities.
func (*BillyFS) Chroot ¶
func (b *BillyFS) Chroot(path string) (billy.Filesystem, error)
Chroot implements billy.Chroot.Chroot.
Click to show internal directories.
Click to hide internal directories.