Go Flysystem is a filesystem abstraction which allows you to easily swap out a local filesystem for a remote one.
Inspired by: https://github.com/thephpleague/flysystem
go get github.com/edwin-luijten/go_flysystem
import (
"github.com/edwin-luijten/go_flysystem/adapter"
)
func main() {
a, err := adapter.NewLocal("./_testdata")
if err != nil {
panic(err)
}
// Write
err = a.Write("test.txt", []byte("hello"))
if err != nil {
t.Log(err)
t.Fail()
}
}
import (
"github.com/edwin-luijten/go_flysystem/adapter"
)
func main() {
a, err := adapter.NewLocal("./_testdata")
if err != nil {
panic(err)
}
b, err = adapter.NewLocal("./_testdata")
if err != nil {
panic(err)
}
fs, err = flysystem.New(a, b)
// Write
err = fs.Write("test.txt", []byte("hello"))
if err != nil {
t.Log(err)
t.Fail()
}
}