studio-b12 / gowebdav

A golang WebDAV client library and command line tool.
BSD 3-Clause "New" or "Revised" License
309 stars 89 forks source link

An idea of supporting writeCloser #63

Closed the-plate closed 1 year ago

the-plate commented 1 year ago

We could do something like this to support upload files(bytes) via WriteCloser... Any hints or recommendations are welcome.

chripo commented 1 year ago

thanks for the pull request. what are the benefits over

c := gowebdav.NewClient("/", "usr", "pw")
r, w := io.Pipe()
go func() {
   defer w.Close()
   fmt.Fprint(w, "foo bar")
}()
_ := c.WriteStream("/foobar.txt", r, 0660)

This could be handled by a wrapper function outside the project.

chripo commented 1 year ago

Please rebase on master and try to address the feedback. thank you!

the-plate commented 1 year ago

I will clone the pull request, the idea is not needed any more...