This is a file server that allows clients to sync a filesystem with the server
import (
"github.com/walesey/go-fileserver/client"
"github.com/walesey/go-fileserver/server"
)
// start server
server.NewServer(".").Start(3000)
// sync directory with server
c := client.NewClient(".", "http://localhost:3000")
if err := c.SyncFiles("."); err != nil {
log.Println(err)
}
- Start server (on port 3000)
$ go-fileserver -server -port 3000 -path ./path/to/files
- Run sync against the server (into the current directory)
$ go-fileserver -host localhost -port 3000 -path ./remote/path -out .