https://github.com/jipok/webdavwithpatch
Sabre Dav HTTP PATCH(partial PUT) Method support for go webdav server
https://github.com/jipok/webdavwithpatch
go golang partial-updates sabredav webdav webdav-server webdavfs
Last synced: 3 months ago
JSON representation
Sabre Dav HTTP PATCH(partial PUT) Method support for go webdav server
- Host: GitHub
- URL: https://github.com/jipok/webdavwithpatch
- Owner: Jipok
- Created: 2024-03-02T13:02:55.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-03-02T19:55:06.000Z (about 1 year ago)
- Last Synced: 2025-01-13T15:50:33.758Z (4 months ago)
- Topics: go, golang, partial-updates, sabredav, webdav, webdav-server, webdavfs
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
## webdavWithPATCH
Adds the ability to the [standard go WebDav server](https://pkg.go.dev/golang.org/x/net/webdav) to update files partially.Made through implementation of [SaberDAV HTTP PATCH](https://sabre.io/dav/http-patch/)
Useful for use in clients that mount webdav as a file system (for example [webdavfs](https://github.com/miquels/webdavfs)).
Example usage:
```go
package mainimport (
"flag"
"log"
"net/http""github.com/Jipok/webdavWithPATCH"
"golang.org/x/net/webdav"
)var (
Addr string
TargetDir string
)func main() {
flag.StringVar(&Addr, "l", "127.0.0.1:8080", "interface:port for WebDav server to listen")
flag.StringVar(&TargetDir, "t", "./", "target dir")
flag.Parse()fs := webdav.Dir(TargetDir)
handler := &webdavWithPATCH.Handler{
Handler: webdav.Handler{
FileSystem: fs,
LockSystem: webdav.NewMemLS(),
},
}server := &http.Server{
Addr: Addr,
Handler: handler,
}log.Printf("Starting WebDAV server on http://%s \n", Addr)
err := server.ListenAndServe()
if err != nil {
log.Fatal("Error starting server: ", err)
}
}```